mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
WIP: Tokens works well with collection. Dissapear upon picking up across all clients.
Still bug with mark ordering and arrows :/ #story[1250]
This commit is contained in:
@@ -54,18 +54,18 @@ public class GameState implements Runnable {
|
|||||||
private Logger logger = LoggerFactory.getLogger(GameState.class);
|
private Logger logger = LoggerFactory.getLogger(GameState.class);
|
||||||
|
|
||||||
|
|
||||||
public static final int WARNING_TIME = 10 * -1000;
|
static final int WARNING_TIME = 10 * -1000;
|
||||||
public static final int PREPATORY_TIME = 5 * -1000;
|
static final int PREPATORY_TIME = 5 * -1000;
|
||||||
public static final int TIME_TILL_START = 10 * 1000;
|
private static final int TIME_TILL_START = 10 * 1000;
|
||||||
public static Integer MAX_PLAYERS = 8;
|
static Integer MAX_PLAYERS = 8;
|
||||||
|
|
||||||
private static final Integer STATE_UPDATES_PER_SECOND = 60;
|
private static final Integer STATE_UPDATES_PER_SECOND = 60;
|
||||||
public static Double ROUNDING_DISTANCE = 50d; // TODO: 14/08/17 wmu16 - Look into this value further
|
private static Double ROUNDING_DISTANCE = 50d; // TODO: 14/08/17 wmu16 - Look into this value further
|
||||||
public static final Double MARK_COLLISION_DISTANCE = 15d;
|
private static final Double MARK_COLLISION_DISTANCE = 15d;
|
||||||
public static final Double YACHT_COLLISION_DISTANCE = 25.0;
|
public static final Double YACHT_COLLISION_DISTANCE = 25.0;
|
||||||
public static final Double BOUNCE_DISTANCE_MARK = 20.0;
|
private static final Double BOUNCE_DISTANCE_MARK = 20.0;
|
||||||
public static final Double BOUNCE_DISTANCE_YACHT = 30.0;
|
public static final Double BOUNCE_DISTANCE_YACHT = 30.0;
|
||||||
public static final Double COLLISION_VELOCITY_PENALTY = 0.3;
|
private static final Double COLLISION_VELOCITY_PENALTY = 0.3;
|
||||||
|
|
||||||
private static Long previousUpdateTime;
|
private static Long previousUpdateTime;
|
||||||
public static Double windDirection;
|
public static Double windDirection;
|
||||||
@@ -350,6 +350,8 @@ public class GameState implements Runnable {
|
|||||||
if (distance < YACHT_COLLISION_DISTANCE) {
|
if (distance < YACHT_COLLISION_DISTANCE) {
|
||||||
tokens.remove(token);
|
tokens.remove(token);
|
||||||
serverYacht.setPowerUp(token.getTokenType());
|
serverYacht.setPowerUp(token.getTokenType());
|
||||||
|
logger.debug("Yacht: " + serverYacht.getShortName() + " got powerup " + token
|
||||||
|
.getTokenType());
|
||||||
notifyMessageListeners(MessageFactory.getRaceXML());
|
notifyMessageListeners(MessageFactory.getRaceXML());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
|||||||
terminated = false;
|
terminated = false;
|
||||||
thread = new Thread(this, "MainServer");
|
thread = new Thread(this, "MainServer");
|
||||||
startUpdatingWind();
|
startUpdatingWind();
|
||||||
// startSpawningTokens();
|
startSpawningTokens();
|
||||||
thread.start();
|
thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,16 @@ import seng302.utilities.XMLGenerator;
|
|||||||
* A Class for interfacing between the data we have in the GameState to the messages we need to send
|
* A Class for interfacing between the data we have in the GameState to the messages we need to send
|
||||||
* through the MainServerThread.
|
* through the MainServerThread.
|
||||||
*
|
*
|
||||||
* WARNING DO NOT USE THIS CLASS IF GAMESTATE HAS NOT BEEN INSTANTIATED.
|
* WARNING DO NOT USE THIS CLASS IF GAMESTATE HAS NOT BEEN INSTANTIATED. (Main Server has not started)
|
||||||
* // TODO: 29/08/17 wmu16 - Make GameState non static to fix this ¯\_(ツ)_/¯
|
* // TODO: 29/08/17 wmu16 - Make GameState non static to fix this ¯\_(ツ)_/¯
|
||||||
* Created by wmu16 on 29/08/17.
|
* Created by wmu16 on 29/08/17.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Ideally this class would be created with an instance of the GameState (I tried implementing this for
|
||||||
|
a bit) but it was too difficult to properly make GameState non static without doing some proper
|
||||||
|
re working. To do later.
|
||||||
|
*/
|
||||||
public class MessageFactory {
|
public class MessageFactory {
|
||||||
|
|
||||||
private static XMLGenerator xmlGenerator = new XMLGenerator();
|
private static XMLGenerator xmlGenerator = new XMLGenerator();
|
||||||
|
|||||||
Reference in New Issue
Block a user