mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
merging with wake remake #story[820]
This commit is contained in:
@@ -179,10 +179,10 @@ public class BoatGroup extends RaceObject{
|
||||
* @param rotation Rotation to move graphics to.
|
||||
* @param raceIds RaceID of the object to move.
|
||||
*/
|
||||
public void setDestination (double newXValue, double newYValue, double rotation, int... raceIds) {
|
||||
public void setDestination (double newXValue, double newYValue, double rotation, double groundSpeed, int... raceIds) {
|
||||
if (hasRaceId(raceIds)) {
|
||||
destinationSet = true;
|
||||
boat.setVelocity(StreamParser.boatSpeeds.get((long)boat.getId()));
|
||||
boat.setVelocity(groundSpeed);
|
||||
if (currentRotation < 0)
|
||||
currentRotation = 360 - currentRotation;
|
||||
double dx = newXValue - boatPoly.getLayoutX();
|
||||
@@ -227,19 +227,21 @@ public class BoatGroup extends RaceObject{
|
||||
}
|
||||
|
||||
public void setDestination (double newXValue, double newYValue, int... raceIDs) {
|
||||
destinationSet = true;
|
||||
|
||||
if (hasRaceId(raceIDs)) {
|
||||
double rotation = Math.abs(
|
||||
Math.toDegrees(
|
||||
Math.atan(
|
||||
(newYValue - boatPoly.getLayoutY()) / (newXValue - boatPoly.getLayoutX())
|
||||
)
|
||||
)
|
||||
);
|
||||
setDestination(newXValue, newYValue, rotation, raceIDs);
|
||||
}
|
||||
}
|
||||
// public void setDestination (double newXValue, double newYValue, int... raceIDs) {
|
||||
// destinationSet = true;
|
||||
//
|
||||
// if (hasRaceId(raceIDs)) {
|
||||
// double rotation = Math.abs(
|
||||
// Math.toDegrees(
|
||||
// Math.atan(
|
||||
// (newYValue - boatPoly.getLayoutY()) / (newXValue - boatPoly.getLayoutX())
|
||||
// )
|
||||
// )
|
||||
// );
|
||||
// setDestination(newXValue, newYValue, rotation, raceIDs);
|
||||
// }
|
||||
// }
|
||||
|
||||
public void rotateTo (double rotation) {
|
||||
currentRotation = rotation;
|
||||
|
||||
@@ -59,9 +59,10 @@ public abstract class RaceObject extends Group {
|
||||
* @param x X co-ordinate to move the graphics to.
|
||||
* @param y Y co-ordinate to move the graphics to.
|
||||
* @param rotation Rotation to move graphics to.
|
||||
* @param groundSpeed boat groundspeed.
|
||||
* @param raceIds RaceID of the object to move.
|
||||
*/
|
||||
public abstract void setDestination (double x, double y, double rotation, int... raceIds);
|
||||
public abstract void setDestination (double x, double y, double rotation, double groundSpeed, int... raceIds);
|
||||
/**
|
||||
* Sets the destination of everything within the RaceObject that has an ID in the array raceIds. The destination is
|
||||
* set to the co-ordinates (x, y).
|
||||
|
||||
@@ -102,7 +102,7 @@ public class MarkGroup extends RaceObject {
|
||||
//moveTo(points[0].getX(), points[0].getY());
|
||||
}
|
||||
|
||||
public void setDestination (double x, double y, double rotation, int... raceIds) {
|
||||
public void setDestination (double x, double y, double rotation, double groundSpeed, int... raceIds) {
|
||||
setDestination(x, y, raceIds);
|
||||
this.rotationalGoal = rotation;
|
||||
calculateRotationalVelocity();
|
||||
|
||||
@@ -5,6 +5,7 @@ import javafx.geometry.Point3D;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import seng302.models.Boat;
|
||||
import seng302.models.parsers.packets.BoatPositionPacket;
|
||||
import seng302.models.parsers.packets.StreamPacket;
|
||||
|
||||
@@ -337,7 +338,7 @@ public class StreamParser extends Thread{
|
||||
long heading = bytesToLong(headingBytes);
|
||||
double groundSpeed = bytesToLong(groundSpeedBytes)/1000.0;
|
||||
short s = (short) ((groundSpeedBytes[1] & 0xFF) << 8 | (groundSpeedBytes[0] & 0xFF));
|
||||
if ((int)deviceType == 1){
|
||||
if ((int)deviceType == 1 || (int)deviceType == 3){
|
||||
|
||||
BoatPositionPacket boatPacket = new BoatPositionPacket(boatId, timeValid, lat, lon, heading, groundSpeed);
|
||||
|
||||
|
||||
@@ -32,4 +32,8 @@ public class BoatPositionPacket {
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
public double getGroundSpeed() {
|
||||
return groundSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user