mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Started implementing the gameState broadcasts.
Initial xml files are almost broad casted, just need to create them (or import the for the regatta). Started the setup for sending boat location packets, should work once we get at least the boat xml working when being sent. #story[1047]
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
package seng302.gameServer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import seng302.models.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import seng302.models.Yacht;
|
||||
import seng302.server.messages.BoatActionType;
|
||||
|
||||
@@ -30,6 +28,7 @@ public class GameState {
|
||||
players = new ArrayList<>();
|
||||
currentStage = GameStages.LOBBYING;
|
||||
isRaceStarted = false;
|
||||
yachts = new HashMap<>();
|
||||
//set this when game stage changes to prerace
|
||||
previousUpdateTime = System.currentTimeMillis();
|
||||
}
|
||||
@@ -74,6 +73,10 @@ public class GameState {
|
||||
return windSpeed;
|
||||
}
|
||||
|
||||
public static Map<Integer, Yacht> getYachts() {
|
||||
return yachts;
|
||||
}
|
||||
|
||||
public static void updateBoat(Integer sourceId, BoatActionType actionType) {
|
||||
switch (actionType) {
|
||||
case VMG:
|
||||
@@ -92,6 +95,7 @@ public class GameState {
|
||||
}
|
||||
|
||||
public static void update() {
|
||||
|
||||
Long timeInterval = System.currentTimeMillis() - previousUpdateTime;
|
||||
previousUpdateTime = System.currentTimeMillis();
|
||||
for (Yacht yacht : yachts.values()) {
|
||||
|
||||
Reference in New Issue
Block a user