added the rocket sound wav and fixed code and check style
also includes minor fixes
This commit is contained in:
@@ -213,25 +213,26 @@ public void received(ShootMessage msg, int from) {
|
||||
*/
|
||||
@Override
|
||||
public void received(AnimationEndMessage msg, int from){
|
||||
if(state != ServerState.ANIMATION_WAIT)
|
||||
if(state != ServerState.ANIMATION_WAIT) {
|
||||
LOGGER.log(Level.ERROR, "animation not allowed in {0}", state);
|
||||
else
|
||||
if(getPlayerById(from) == players.get(0)){
|
||||
LOGGER.log(Level.DEBUG, "{0} set to true", getPlayerById(from));
|
||||
player1AnimationReady = true;
|
||||
shoot(getPlayerById(from), msg.getPosition());
|
||||
} else if (getPlayerById(from) == players.get(1)){
|
||||
LOGGER.log(Level.DEBUG, "{0} set to true {1}", getPlayerById(from), getPlayerById(from).toString());
|
||||
player2AnimationReady = true;
|
||||
shoot(getPlayerById(from), msg.getPosition());
|
||||
}
|
||||
if(player1AnimationReady && player2AnimationReady){
|
||||
setState(ServerState.BATTLE);
|
||||
for (Player player : players)
|
||||
send(player, new SwitchBattleState(player == activePlayer));
|
||||
player1AnimationReady = false;
|
||||
player2AnimationReady = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(getPlayerById(from) == players.get(0)){
|
||||
LOGGER.log(Level.DEBUG, "{0} set to true", getPlayerById(from));
|
||||
player1AnimationReady = true;
|
||||
shoot(getPlayerById(from), msg.getPosition());
|
||||
} else if (getPlayerById(from) == players.get(1)){
|
||||
LOGGER.log(Level.DEBUG, "{0} set to true {1}", getPlayerById(from), getPlayerById(from).toString());
|
||||
player2AnimationReady = true;
|
||||
shoot(getPlayerById(from), msg.getPosition());
|
||||
}
|
||||
if(player1AnimationReady && player2AnimationReady){
|
||||
setState(ServerState.BATTLE);
|
||||
for (Player player : players)
|
||||
send(player, new SwitchBattleState(player == activePlayer));
|
||||
player1AnimationReady = false;
|
||||
player2AnimationReady = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,6 +26,7 @@ class InterpreterProxy implements ServerInterpreter {
|
||||
*
|
||||
* @param playerClient the client to which the server messages are forwarded
|
||||
*/
|
||||
|
||||
InterpreterProxy(BattleshipClient playerClient) {
|
||||
this.playerClient = playerClient;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user