diff --git a/src/main/java/seng302/visualiser/GameView3D.java b/src/main/java/seng302/visualiser/GameView3D.java index 02b28e65..d53024da 100644 --- a/src/main/java/seng302/visualiser/GameView3D.java +++ b/src/main/java/seng302/visualiser/GameView3D.java @@ -37,7 +37,6 @@ import seng302.model.mark.Corner; import seng302.model.mark.Mark; import seng302.model.token.Token; import seng302.utilities.GeoUtility; -import seng302.visualiser.fxObjects.assets_2D.AnnotationBox; import seng302.visualiser.fxObjects.assets_2D.BoatObject; import seng302.visualiser.fxObjects.assets_3D.ModelFactory; import seng302.visualiser.fxObjects.assets_3D.ModelType; @@ -82,18 +81,16 @@ public class GameView3D { private Map markerObjects; private Map boatObjects = new HashMap<>(); - private Map annotations = new HashMap<>(); private BoatObject selectedBoat = null; - private Group annotationsGroup = new Group(); private Group wakesGroup = new Group(); private Group boatObjectGroup = new Group(); private Group markers = new Group(); private Group tokens = new Group(); + private Group playerAnnotation = new Group(); private List course = new ArrayList<>(); private List mapTokens; - private Timer trailMaker = new Timer(); + private Timer playerBoatAnimationTimer = new Timer(); private Group trail = new Group(); - private ImageView mapImage = new ImageView(); //FRAME RATE @@ -181,7 +178,7 @@ public class GameView3D { gameObjects.getChildren().addAll( // ModelFactory.importModel(ModelType.OCEAN).getAssets(), - raceBorder, trail, markers, tokens, + raceBorder, trail, markers, tokens, playerAnnotation, white, blue, green, black, red ); @@ -674,7 +671,14 @@ public class GameView3D { public void setBoatAsPlayer (ClientYacht playerYacht) { this.playerYacht = playerYacht; - trailMaker.scheduleAtFixedRate(new TimerTask() { + Platform.runLater(() -> + playerAnnotation.getChildren().setAll(ModelFactory.importModel(ModelType.PLAYER_IDENTIFIER).getAssets()) + ); + BoatObject playerAssets = boatObjects.get(playerYacht); + playerAnnotation.layoutXProperty().bind(playerAssets.layoutXProperty()); + playerAnnotation.layoutYProperty().bind(playerAssets.layoutYProperty()); + + playerBoatAnimationTimer.scheduleAtFixedRate(new TimerTask() { private Point2D lastLocation = findScaledXY(playerYacht.getLocation()); @@ -694,6 +698,21 @@ public class GameView3D { } }); lastLocation = location; + // TODO: 11/09/2017 ROTATE PLAYER ICON +// double leg = playerYacht.getLegNumber(); +// if (compoundMark != null) { +// for (Mark mark : compoundMark.getMarks()) { +//// System.out.println("markerObjects.get(mark) = " + markerObjects.get(mark)); +// markerObjects.get(mark).showNextExitArrow(); +// } +// } +// CompoundMark nextMark = null; +// if (legNumber < course.size() - 1) { +// nextMark = course.get(legNumber); +// for (Mark mark : nextMark.getMarks()) { +// markerObjects.get(mark).showNextEnterArrow(); +// } +// } } }, 0L, 500L); diff --git a/src/main/java/seng302/visualiser/fxObjects/assets_2D/BoatObject.java b/src/main/java/seng302/visualiser/fxObjects/assets_2D/BoatObject.java index f7b4b160..f087e15c 100644 --- a/src/main/java/seng302/visualiser/fxObjects/assets_2D/BoatObject.java +++ b/src/main/java/seng302/visualiser/fxObjects/assets_2D/BoatObject.java @@ -3,6 +3,8 @@ package seng302.visualiser.fxObjects.assets_2D; import java.util.ArrayList; import java.util.List; import javafx.application.Platform; +import javafx.beans.property.ReadOnlyDoubleWrapper; +import javafx.beans.property.SimpleDoubleProperty; import javafx.geometry.Point2D; import javafx.geometry.Point3D; import javafx.scene.AmbientLight; diff --git a/src/main/java/seng302/visualiser/fxObjects/assets_3D/ModelType.java b/src/main/java/seng302/visualiser/fxObjects/assets_3D/ModelType.java index 57b133cf..d0726aa5 100644 --- a/src/main/java/seng302/visualiser/fxObjects/assets_3D/ModelType.java +++ b/src/main/java/seng302/visualiser/fxObjects/assets_3D/ModelType.java @@ -18,7 +18,7 @@ public enum ModelType { START_LINE ("start_line.dae"), GATE_LINE ("gate_line.dae"), WAKE ("wake.dae"), - TRAIL_SEGMENT ("trail_segment.dae"); + TRAIL_SEGMENT ("trail_segment.dae"), PLAYER_IDENTIFIER ("player_identifier.dae"); final String filename;