mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Fixed Boats powering up and down correctly. Icons respond correctly
#story[1293]
This commit is contained in:
@@ -78,8 +78,8 @@ public class GameState implements Runnable {
|
||||
private static final Double COLLISION_VELOCITY_PENALTY = 0.3;
|
||||
|
||||
//Powerup Constants
|
||||
private static final Integer VELOCITY_BOOST_MULTIPLIER = 2;
|
||||
private static final Integer HANDLING_BOOST_MULTIPLIER = 2;
|
||||
public static final Integer VELOCITY_BOOST_MULTIPLIER = 2;
|
||||
public static final Integer HANDLING_BOOST_MULTIPLIER = 2;
|
||||
public static final Long BUMPER_DISABLE_TIME = 5_000L;
|
||||
private static final Long TOKEN_SPAWN_TIME = 15_000L;
|
||||
|
||||
@@ -550,20 +550,6 @@ public class GameState implements Runnable {
|
||||
}
|
||||
|
||||
TokenType tokenType = collidedToken.getTokenType();
|
||||
switch (tokenType) {
|
||||
case BOOST:
|
||||
yacht.setPowerUpSpeedMultiplier(VELOCITY_BOOST_MULTIPLIER);
|
||||
break;
|
||||
case BUMPER:
|
||||
// TODO: 22/09/17 wmu16
|
||||
break;
|
||||
case HANDLING:
|
||||
yacht.setPowerUpHandlingMultiplier(HANDLING_BOOST_MULTIPLIER);
|
||||
break;
|
||||
case WIND_WALKER:
|
||||
// TODO: 22/09/17 wmu16
|
||||
break;
|
||||
}
|
||||
yacht.powerUp(tokenType);
|
||||
|
||||
String logMessage =
|
||||
|
||||
@@ -112,11 +112,29 @@ public class ServerYacht {
|
||||
location = geoPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Powers up a yacht with a given yacht, only after powering it down first to avoid double power
|
||||
* ups
|
||||
*
|
||||
* @param powerUp The given power up
|
||||
*/
|
||||
public void powerUp(TokenType powerUp) {
|
||||
powerDown();
|
||||
switch (powerUp) {
|
||||
case BOOST:
|
||||
powerUpSpeedMultiplier = GameState.VELOCITY_BOOST_MULTIPLIER;
|
||||
break;
|
||||
case HANDLING:
|
||||
powerUpHandlingMultiplier = GameState.HANDLING_BOOST_MULTIPLIER;
|
||||
break;
|
||||
}
|
||||
this.powerUp = powerUp;
|
||||
powerUpStartTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Powers down a yacht, returning its power multipliers back to 1
|
||||
*/
|
||||
public void powerDown() {
|
||||
this.powerUp = null;
|
||||
this.powerUpSpeedMultiplier = 1;
|
||||
|
||||
@@ -55,6 +55,7 @@ import seng302.model.RaceState;
|
||||
import seng302.model.mark.CompoundMark;
|
||||
import seng302.model.mark.Mark;
|
||||
import seng302.model.stream.xml.parser.RaceXMLData;
|
||||
import seng302.model.token.Token;
|
||||
import seng302.model.token.TokenType;
|
||||
import seng302.utilities.Sounds;
|
||||
import seng302.visualiser.GameView3D;
|
||||
@@ -307,6 +308,9 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
*/
|
||||
private void displayPowerUpIcon(ClientYacht yacht, TokenType tokenType) {
|
||||
if (yacht == player) {
|
||||
if (iconToDisplay != null) {
|
||||
iconToDisplay.setVisible(false);
|
||||
}
|
||||
|
||||
switch (tokenType) {
|
||||
case BOOST:
|
||||
@@ -349,6 +353,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
||||
if (yacht == player) {
|
||||
blinkingTimer.cancel();
|
||||
iconToDisplay.setVisible(false);
|
||||
iconToDisplay = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user