Added mock yachts to the game state for each client #story[1047]

This commit is contained in:
Peter Galloway
2017-07-20 13:11:37 +12:00
parent 176d65e0b2
commit e317de7562
4 changed files with 31 additions and 37 deletions
@@ -15,6 +15,9 @@ import seng302.models.Yacht;
public class GameState {
private static Long previousUpdateTime;
private static Double windDirection = 0d;
private static Double windSpeed = 0d;
private static String hostIpAddress;
private static List<Player> players;
private static Map<Integer, Yacht> yachts;
@@ -46,6 +49,10 @@ public class GameState {
players.remove(player);
}
public static void addYacht(Integer sourceId, Yacht yatch) {
yachts.put(sourceId, yatch);
}
public static Boolean getIsRaceStarted() {
return isRaceStarted;
}
@@ -58,7 +65,8 @@ public class GameState {
GameState.currentStage = currentStage;
}
public void update() {
public static void update() {
Long timeInterval = System.currentTimeMillis() - previousUpdateTime;
previousUpdateTime = System.currentTimeMillis();
for (Yacht yacht : yachts.values()) {