mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Created Boat bumper logic. Refactored logic for powering up / dpwn
YachtEventType: Added some new events, a generic power down event and a bumper_crash event for an affected boat GameState: Implemented boat bumper logic MessageFactory: Made new messages for powerdown and status effect ClientYacht: Had to create another powerDown functional interface to inform the race view controller when to turn off the icon RaceViewController/GameClient: Now waits for a message about powering down before turning off rather than waiting time client side #story[1293]
This commit is contained in:
@@ -39,11 +39,22 @@ public class ClientYacht extends Observable {
|
||||
void notifyRounding(ClientYacht yacht, int legNumber);
|
||||
}
|
||||
|
||||
//This notifies RaceViewController so it can display icon - wmu16
|
||||
@FunctionalInterface
|
||||
public interface PowerUpListener {
|
||||
|
||||
void notifyPowerUp(ClientYacht yacht, TokenType tokenType);
|
||||
}
|
||||
|
||||
//This notifies RaceViewController so it can remove token icon - wmu16
|
||||
@FunctionalInterface
|
||||
public interface PowerDownListener {
|
||||
|
||||
void notifyPowerDown(ClientYacht yacht);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(ClientYacht.class);
|
||||
|
||||
|
||||
@@ -70,6 +81,8 @@ public class ClientYacht extends Observable {
|
||||
private List<YachtLocationListener> locationListeners = new ArrayList<>();
|
||||
private List<MarkRoundingListener> markRoundingListeners = new ArrayList<>();
|
||||
private List<PowerUpListener> powerUpListeners = new ArrayList<>();
|
||||
private List<PowerDownListener> powerDownListeners = new ArrayList<>();
|
||||
|
||||
private ReadOnlyDoubleWrapper velocityProperty = new ReadOnlyDoubleWrapper();
|
||||
private ReadOnlyLongWrapper timeTillNextProperty = new ReadOnlyLongWrapper();
|
||||
private ReadOnlyLongWrapper timeSinceLastMarkProperty = new ReadOnlyLongWrapper();
|
||||
@@ -211,6 +224,13 @@ public class ClientYacht extends Observable {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public void powerDown() {
|
||||
this.powerUp = null;
|
||||
for (PowerDownListener listener : powerDownListeners) {
|
||||
listener.notifyPowerDown(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPowerUp(TokenType tokenType) {
|
||||
this.powerUp = tokenType;
|
||||
for (PowerUpListener listener : powerUpListeners) {
|
||||
@@ -295,6 +315,10 @@ public class ClientYacht extends Observable {
|
||||
powerUpListeners.add(listener);
|
||||
}
|
||||
|
||||
public void addPowerDownListener(PowerDownListener listener) {
|
||||
powerDownListeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeMarkRoundingListener(MarkRoundingListener listener) {
|
||||
markRoundingListeners.remove(listener);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user