Added mark collisions

- Boats now collide with marks
- Added method to MarkOrder to get all marks
- Reduced the frequency at which collisions are detected. This fixed some performance issues
- Added method to bounce the boat off a mark

Tags: #story[1117]
This commit is contained in:
Michael Rausch
2017-08-09 21:57:50 +12:00
parent 8813d06010
commit 4cc48a355e
3 changed files with 88 additions and 13 deletions
@@ -1,9 +1,7 @@
package seng302.gameServer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
@@ -13,6 +11,8 @@ import seng302.model.Player;
import seng302.model.Yacht;
import seng302.gameServer.server.messages.BoatActionType;
import seng302.model.mark.CompoundMark;
import seng302.model.mark.Mark;
import seng302.model.mark.MarkOrder;
import seng302.utilities.GeoUtility;
/**
@@ -33,6 +33,7 @@ public class GameState implements Runnable {
private static Boolean isRaceStarted;
private static GameStages currentStage;
private static long startTime;
private static Set<Mark> marks;
private static Map<Player, String> playerStringMap = new HashMap<>();
/*
@@ -62,12 +63,18 @@ public class GameState implements Runnable {
yachts = new HashMap<>();
new Thread(this).start();
marks = new MarkOrder().getAllMarks();
}
public static String getHostIpAddress() {
return hostIpAddress;
}
public static Set<Mark> getMarks(){
return Collections.unmodifiableSet(marks);
}
public static List<Player> getPlayers() {
return players;
}