Tried to get multiple boats working but.... it's not #story[1196]
This commit is contained in:
@@ -180,7 +180,7 @@ public class Event {
|
||||
public static String setRaceXMLAtCurrentTimeToNow(String raceXML) {
|
||||
|
||||
//The start time is current time + 4 minutes. prestart is 3 minutes, and we add another minute.
|
||||
long millisecondsToAdd = Constants.RacePreStartTime + Constants.RacePreparatoryTime;
|
||||
long millisecondsToAdd = Constants.RacePreStartTime + 1 * 60 * 10000;
|
||||
long secondsToAdd = millisecondsToAdd / 1000;
|
||||
//Scale the time using our time scalar.
|
||||
secondsToAdd = secondsToAdd / Constants.RaceTimeScale;
|
||||
|
||||
@@ -187,7 +187,7 @@ public class RaceXMLCreator {
|
||||
public static void setRaceXMLAtCurrentTimeToNow(XMLRace raceXML) {
|
||||
|
||||
//The start time is current time + 4 minutes. prestart is 3 minutes, and we add another minute.
|
||||
long millisecondsToAdd = Constants.RacePreStartTime + Constants.RacePreparatoryTime;
|
||||
long millisecondsToAdd = Constants.RacePreStartTime + 1 * 60 * 1000;
|
||||
long secondsToAdd = millisecondsToAdd / 1000;
|
||||
//Scale the time using our time scalar.
|
||||
secondsToAdd = secondsToAdd / Constants.RaceTimeScale;
|
||||
|
||||
@@ -39,14 +39,14 @@ public class Constants {
|
||||
* The race pre-start time, in milliseconds. 3 minutes (30 seconds for development).
|
||||
*/
|
||||
// public static final long RacePreStartTime = 30 * 1000;
|
||||
public static final long RacePreStartTime = 1000;
|
||||
public static final long RacePreStartTime = 30 * 1000;
|
||||
|
||||
|
||||
/**
|
||||
* The race preparatory time, in milliseconds. 1 minute.
|
||||
*/
|
||||
// public static final long RacePreparatoryTime = 60 * 1000;
|
||||
public static final long RacePreparatoryTime = 3 * 1000;
|
||||
public static final long RacePreparatoryTime = 60 * 1000;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ public class HostController extends Controller {
|
||||
*/
|
||||
public void hostGamePressed() {
|
||||
try {
|
||||
this.game = new Event(false);
|
||||
this.game = new Event(true);
|
||||
connectSocket("localhost", 4942);
|
||||
} catch (EventConstructionException e) {
|
||||
Logger.getGlobal().log(Level.SEVERE, "Could not create Event.", e);
|
||||
|
||||
@@ -191,6 +191,10 @@ public class RaceController extends Controller {
|
||||
StlMeshImporter importerMark = new StlMeshImporter();
|
||||
importerMark.read(markerAsset);
|
||||
|
||||
URL alternateBoatAsset = HostController.class.getClassLoader().getResource("assets/V1.3 BurgerBoat.stl");
|
||||
StlMeshImporter importerBurgerBoat = new StlMeshImporter();
|
||||
importerBurgerBoat.read(alternateBoatAsset);
|
||||
|
||||
view3D = new View3D();
|
||||
view3D.setDistance(1050);
|
||||
view3D.setYaw(0);
|
||||
@@ -222,10 +226,14 @@ public class RaceController extends Controller {
|
||||
}
|
||||
|
||||
for(VisualiserBoat boat: race.getVisualiserRaceState().getBoats()) {
|
||||
MeshView mesh = new MeshView(importer.getImport());
|
||||
MeshView mesh = null;
|
||||
if(boat.getSourceID() == race.getVisualiserRaceState().getPlayerBoatID()) {
|
||||
mesh = new MeshView(importer.getImport());
|
||||
} else {
|
||||
mesh = new MeshView(importerBurgerBoat.getImport());
|
||||
}
|
||||
Subject3D subject = new Subject3D(mesh);
|
||||
subjects.add(subject);
|
||||
|
||||
AnimationTimer trackBoat = new AnimationTimer() {
|
||||
@Override
|
||||
public void handle(long now) {
|
||||
|
||||
@@ -33,9 +33,9 @@ public class Subject3D {
|
||||
this.heading = new Rotate(0, Rotate.Y_AXIS);
|
||||
|
||||
this.mesh.getTransforms().addAll(position, heading, new Rotate(90, Rotate.X_AXIS), new Rotate(180, Rotate.Y_AXIS));
|
||||
this.position.xProperty().addListener(((observable, oldValue, newValue) -> System.out.println("Boat x: " + newValue)));
|
||||
this.position.yProperty().addListener(((observable, oldValue, newValue) -> System.out.println("Boat y: " + newValue)));
|
||||
this.position.zProperty().addListener(((observable, oldValue, newValue) -> System.out.println("Boat z: " + newValue)));
|
||||
// this.position.xProperty().addListener(((observable, oldValue, newValue) -> System.out.println("Boat x: " + newValue)));
|
||||
// this.position.yProperty().addListener(((observable, oldValue, newValue) -> System.out.println("Boat y: " + newValue)));
|
||||
// this.position.zProperty().addListener(((observable, oldValue, newValue) -> System.out.println("Boat z: " + newValue)));
|
||||
}
|
||||
|
||||
public Shape3D getMesh() {
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user