Updated 'AnimationState' class.
Updated the 'AnimationState' class by updating the content inside the 'received(AnimationEndMessage msg, int from) method in it.
This commit is contained in:
@@ -11,10 +11,15 @@
|
||||
*/
|
||||
public class AnimationState extends GameAutomatonState {
|
||||
/**
|
||||
* Create FirstRollState constants.
|
||||
* Create AnimationState constants.
|
||||
*/
|
||||
private static final System.Logger LOGGER = System.getLogger(AnimationState.class.getName());
|
||||
|
||||
/**
|
||||
* Create AnimationState attributes.
|
||||
*/
|
||||
private int messageReceived = 0;
|
||||
|
||||
/**
|
||||
* Constructs a server state of the specified game logic.
|
||||
*
|
||||
@@ -33,6 +38,7 @@ public void enter() {
|
||||
@Override
|
||||
public void exit() {
|
||||
LOGGER.log(System.Logger.Level.DEBUG, "Exited AnimationState state.");
|
||||
this.messageReceived = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,7 +50,11 @@ public void exit() {
|
||||
*/
|
||||
@Override
|
||||
public void received(AnimationEndMessage msg, int from) {
|
||||
this.logic.getServerSender().send(from, new DiceNowMessage());
|
||||
this.gameAutomaton.setCurrentState(this.gameAutomaton.getTurnState());
|
||||
if (this.messageReceived == this.logic.getGame().getPlayers().size()) {
|
||||
this.logic.getServerSender().send(this.logic.getGame().getActivePlayerId(), new DiceNowMessage());
|
||||
this.gameAutomaton.setCurrentState(this.gameAutomaton.getTurnState());
|
||||
} else {
|
||||
this.messageReceived++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user