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