Action packets now sent at regular 20ms intervals

#issue[38] #implement
This commit is contained in:
Calum
2017-08-07 10:58:07 +12:00
parent 8a40119a98
commit a3ce5998ff
11 changed files with 23 additions and 24 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ public class Yacht {
private Integer legNumber = 0;
//SERVER SIDE
static public final Double TURN_STEP = 1.0; //This should be in some utils class somewhere 2bh. Public for tests sake.
public static final Double TURN_STEP = 1.0; //This should be in some utils class somewhere 2bh. Public for tests sake.
private Double lastHeading;
private Boolean sailIn;
private GeoPoint location;
@@ -32,8 +32,8 @@ import seng302.visualiser.fxObjects.BoatObject;
import seng302.visualiser.fxObjects.CourseBoundary;
import seng302.visualiser.fxObjects.Gate;
import seng302.visualiser.fxObjects.Marker;
import seng302.v.map.Boundary;
import seng302.v.map.CanvasMap;
import seng302.visualiser.map.Boundary;
import seng302.visualiser.map.CanvasMap;
/**
* Created by cir27 on 20/07/17.
@@ -135,7 +135,7 @@ public class GameView extends Pane {
}
}
// Platform.runLater(() ->
// boatObjects.forEach((boat, boatObject) -> boatObject.updateLocation())
boatObjects.forEach((boat, boatObject) -> boatObject.updateLocation());
// );
}
};
@@ -242,15 +242,15 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
}
});
// Adds the new data series to the sparkline (and set the colour of the series)
Platform.runLater(() -> {
Platform.runLater(() ->
sparkLineData
.stream()
.filter(spark -> !raceSparkLine.getData().contains(spark))
.forEach(spark -> {
raceSparkLine.getData().add(spark);
spark.getNode().lookup(".chart-series-line").setStyle("-fx-stroke:" + getBoatColorAsRGB(spark.getName()));
});
});
})
);
}
private void initialiseSparkLine() {
@@ -268,7 +268,7 @@ public class BoatObject extends Group {
*/
public void setAsPlayer() {
boatPoly.getPoints().setAll(
-BOAT_WIDTH / 1.75, BOAT_HEIGHT / 1.75,
-BOAT_WIDTH / 1.75, BOAT_HEIGHT / 1.75,
0.0, -BOAT_HEIGHT / 1.75,
BOAT_WIDTH / 1.75, BOAT_HEIGHT / 1.75
);
@@ -52,7 +52,7 @@ public class Wake extends Group {
arc.setFill(new Color(0.0, 0.0, 0.0, 0.0));
arcs[i] = arc;
arc.getTransforms().setAll(
new Rotate(1)
new Rotate(1)
);
}
super.getChildren().addAll(arcs);
@@ -60,15 +60,15 @@ public class Wake extends Group {
void setRotation (double rotation, double velocity) {
// if (Math.abs(rotations[0] - rotation) > 20) {
Platform.runLater(() -> {
rotate(rotation);
double rad = (14 / numWakes) + velocity;
for (Arc arc : arcs) {
arc.setRadiusX(rad);
arc.setRadiusY(rad);
rad += (14 / numWakes) + (velocity / 2.5);
}
});
Platform.runLater(() -> {
rotate(rotation);
double rad = (14 / numWakes) + velocity;
for (Arc arc : arcs) {
arc.setRadiusX(rad);
arc.setRadiusY(rad);
rad += (14 / numWakes) + (velocity / 2.5);
}
});
// } else {
// rotations[0] = rotation;
// ((Rotate) arcs[0].getTransforms().get(0)).setAngle(rotation);
@@ -1,4 +1,4 @@
package seng302.v.map;
package seng302.visualiser.map;
/**
* The Boundary class represents a rectangle territorial boundary on a map. It
@@ -1,4 +1,4 @@
package seng302.v.map;
package seng302.visualiser.map;
import java.net.URL;
import javafx.geometry.Point2D;
@@ -1,4 +1,4 @@
package seng302.v.map;
package seng302.visualiser.map;
import javafx.geometry.Point2D;
import seng302.model.GeoPoint;
@@ -1,4 +1,4 @@
package seng302.v.map;
package seng302.visualiser.map;
import java.net.URL;
import java.util.ResourceBundle;