mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Added placeholder assets for velocity pickups.
This commit is contained in:
@@ -473,7 +473,7 @@ public class GameView extends Pane {
|
||||
mapTokens = new ArrayList<>();
|
||||
for (Token token : newTokens) {
|
||||
Point2D location = findScaledXY(token.getLat(), token.getLng());
|
||||
Node tokenObject = ModelFactory.importModel(ModelType.VELOCITY_COIN).getAssets();
|
||||
Node tokenObject = ModelFactory.importModel(ModelType.VELOCITY_PICKUP).getAssets();
|
||||
tokenObject.setLayoutX(location.getX());
|
||||
tokenObject.setLayoutY(location.getY());
|
||||
mapTokens.add(tokenObject);
|
||||
|
||||
@@ -13,9 +13,6 @@ import javafx.scene.*;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.paint.Paint;
|
||||
import javafx.scene.shape.Circle;
|
||||
import javafx.scene.shape.Polygon;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.transform.Rotate;
|
||||
import javafx.scene.transform.Scale;
|
||||
@@ -27,6 +24,7 @@ import seng302.model.Limit;
|
||||
import seng302.model.mark.CompoundMark;
|
||||
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.*;
|
||||
import seng302.visualiser.fxObjects.assets_3D.ModelFactory;
|
||||
@@ -130,7 +128,7 @@ public class GameView3D {
|
||||
|
||||
gameObjects.getChildren().addAll(
|
||||
ModelFactory.importModel(ModelType.OCEAN).getAssets(),
|
||||
raceBorder, markers
|
||||
raceBorder, markers, tokens
|
||||
);
|
||||
|
||||
// Sphere s = new Sphere(1);
|
||||
@@ -163,7 +161,7 @@ public class GameView3D {
|
||||
// Node marker = ModelFactory.importModel(ModelType.PLAIN_MARKER).getAssets();
|
||||
// marker.getTransforms().add(0, new Translate(30, 0, 0));
|
||||
//
|
||||
// Node coin = ModelFactory.importModel(ModelType.VELOCITY_COIN).getAssets();
|
||||
// Node coin = ModelFactory.importModel(ModelType.VELOCITY_PICKUP).getAssets();
|
||||
// coin.setTranslateX(coin.getTranslateX() - 30);
|
||||
//
|
||||
// gameObjects.getChildren().addAll(
|
||||
@@ -223,7 +221,7 @@ public class GameView3D {
|
||||
} else {
|
||||
gateType = ModelType.GATE_LINE;
|
||||
}
|
||||
gates.add(makeAndBindGate(
|
||||
gates.add(makeGate(
|
||||
cMark.getSubMark(1), cMark.getSubMark(2), gateType
|
||||
));
|
||||
}
|
||||
@@ -273,7 +271,7 @@ public class GameView3D {
|
||||
* @param gateType The type of model for the gate.
|
||||
* @return the new gate.
|
||||
*/
|
||||
private Group makeAndBindGate(Mark m1, Mark m2, ModelType gateType) {
|
||||
private Group makeGate(Mark m1, Mark m2, ModelType gateType) {
|
||||
Point2D m1Location = findScaledXY(m1);
|
||||
Point2D m2Location = findScaledXY(m2);
|
||||
|
||||
@@ -600,4 +598,24 @@ public class GameView3D {
|
||||
|
||||
Platform.runLater(() -> raceBorder.getChildren().setAll(boundaryAssets));
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces all tokens in the course with those passed in
|
||||
*
|
||||
* @param newTokens the tokens to be put on the course.
|
||||
*/
|
||||
public void updateTokens(List<Token> newTokens) {
|
||||
mapTokens = new ArrayList<>();
|
||||
for (Token token : newTokens) {
|
||||
Point2D location = findScaledXY(token.getLat(), token.getLng());
|
||||
Node tokenObject = ModelFactory.importModel(ModelType.VELOCITY_PICKUP).getAssets();
|
||||
tokenObject.setLayoutX(location.getX());
|
||||
tokenObject.setLayoutY(location.getY());
|
||||
mapTokens.add(tokenObject);
|
||||
}
|
||||
|
||||
Platform.runLater(() -> {
|
||||
tokens.getChildren().setAll(mapTokens);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
Platform.runLater(() -> contentAnchorPane.getChildren().add(0, gameView.getAssets()));
|
||||
gameView.setBoats(new ArrayList<>(participants.values()));
|
||||
gameView.updateBorder(raceData.getCourseLimit());
|
||||
// gameView.updateTokens(raceData.getTokens());
|
||||
gameView.updateTokens(raceData.getTokens());
|
||||
gameView.updateCourse(
|
||||
new ArrayList<>(raceData.getCompoundMarks().values()), raceData.getMarkSequence()
|
||||
);
|
||||
@@ -630,7 +630,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
}
|
||||
|
||||
public void updateRaceData (RaceXMLData raceData) {
|
||||
// gameView.updateBorder(raceData.getCourseLimit());
|
||||
// gameView.updateTokens(raceData.getTokens());
|
||||
gameView.updateBorder(raceData.getCourseLimit());
|
||||
gameView.updateTokens(raceData.getTokens());
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public class ModelFactory {
|
||||
assets = new Group(importer.getImport());
|
||||
}
|
||||
switch (tokenType) {
|
||||
case VELOCITY_COIN:
|
||||
case VELOCITY_PICKUP:
|
||||
return makeCoinPickup(assets);
|
||||
case FINISH_MARKER:
|
||||
case PLAIN_MARKER:
|
||||
@@ -114,7 +114,10 @@ public class ModelFactory {
|
||||
assets.setRotate(90);
|
||||
assets.setTranslateX(0.2);
|
||||
assets.setTranslateY(1);
|
||||
assets.getTransforms().add(new Rotate(0 ,new Point3D(0,1,0)));
|
||||
assets.getTransforms().addAll(
|
||||
new Translate(0,-1,0),
|
||||
new Rotate(0 ,new Point3D(1,1,1))
|
||||
);
|
||||
return new Model(assets, new AnimationTimer() {
|
||||
|
||||
private double rotation = 0;
|
||||
@@ -122,8 +125,8 @@ public class ModelFactory {
|
||||
|
||||
@Override
|
||||
public void handle(long now) {
|
||||
rotation += 0.5;
|
||||
((Rotate) group.getTransforms().get(0)).setAngle(rotation);
|
||||
rotation += 1;
|
||||
((Rotate) group.getTransforms().get(1)).setAngle(rotation);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package seng302.visualiser.fxObjects.assets_3D;
|
||||
*/
|
||||
public enum ModelType {
|
||||
|
||||
VELOCITY_COIN ("velocity_pickup.dae"),
|
||||
VELOCITY_PICKUP("velocity_pickup.dae"),
|
||||
FINISH_MARKER ("finish_marker.dae"),
|
||||
START_MARKER ("start_marker.dae"),
|
||||
PLAIN_MARKER ("plain_marker.dae"),
|
||||
|
||||
Reference in New Issue
Block a user