Merged master.
This commit is contained in:
@@ -342,13 +342,13 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
double[] x = {
|
||||
pos.getX() - 9,
|
||||
pos.getX(),
|
||||
pos.getX() + 9 };
|
||||
pos.getX() + 9};
|
||||
|
||||
//The y coordinates of each vertex of the boat.
|
||||
double[] y = {
|
||||
pos.getY() + 15,
|
||||
pos.getY() - 15,
|
||||
pos.getY() + 15 };
|
||||
pos.getY() + 15};
|
||||
|
||||
//The above shape is essentially a triangle 24px wide, and 48 long.
|
||||
|
||||
@@ -359,6 +359,7 @@ public class ResizableRaceCanvas extends ResizableCanvas {
|
||||
rotate(boat.getBearing().degrees(), pos.getX(), pos.getY());
|
||||
gc.fillPolygon(x, y, 3);
|
||||
gc.restore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws sails for a given boat on the canvas. Sail position is
|
||||
|
||||
@@ -4,9 +4,7 @@ package visualiser.model;
|
||||
* The properties of the boat currently being controlled by the player. Singleton.
|
||||
*/
|
||||
public class ThisBoat {
|
||||
// TODO Initialise sourceID to the sourceID given by the network
|
||||
private int sourceID = 125;
|
||||
private boolean sailsOut = true;
|
||||
private VisualiserBoat boat;
|
||||
private static ThisBoat instance = new ThisBoat();
|
||||
|
||||
private ThisBoat(){}
|
||||
@@ -16,18 +14,18 @@ public class ThisBoat {
|
||||
}
|
||||
|
||||
public void setSailsOut(boolean sailsOut) {
|
||||
this.sailsOut = sailsOut;
|
||||
}
|
||||
|
||||
public void setSourceID(int sourceID) {
|
||||
this.sourceID = sourceID;
|
||||
this.boat.setSailsOut(sailsOut);
|
||||
}
|
||||
|
||||
public boolean isSailsOut() {
|
||||
return sailsOut;
|
||||
return this.boat.isSailsOut();
|
||||
}
|
||||
|
||||
public int getSourceID() {
|
||||
return sourceID;
|
||||
return this.boat.getSourceID();
|
||||
}
|
||||
|
||||
public void setBoat(VisualiserBoat boat) {
|
||||
this.boat = boat;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,6 +206,7 @@ public class VisualiserRaceState extends RaceState {
|
||||
|
||||
if (boat.getSourceID() == getPlayerBoatID()) {
|
||||
boat.setClientBoat(true);
|
||||
ThisBoat.getInstance().setBoat(boat);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user