@Override public void update(GameManager manager) { if (manager.allPlayersReady()) { for (Player player : manager.players.values()) { player.revealDice(); } manager.state = GameManagerState.WAIT_FOR_CHOICE_TO_PLAY; } }
@Override public void update(GameManager manager) { if (manager.allPlayersReady()) { for (Player players : manager.players.values()) { players.reset(); } manager.newGame(); manager.state = GameManagerState.WAIT_FOR_PLAYER_READY; } }
@Override public void update(GameManager manager) { if (manager.allPlayersReady()) { for (Player players : manager.players.values()) { players.endGame(manager.endGameInfo); } manager.unreadyAll(); manager.state = GameManagerState.WAIT_FOR_PLAY_AGAIN; } }
@Override public void update(GameManager manager) { if (manager.isChoicePlayed) { if (manager.choicePlayed != null) { for (Player player : manager.players.values()) { player.playChoice(manager.choicePlayed); } } manager.isChoicePlayed = false; manager.choicePlayed = null; manager.unreadyAll(); if (manager.isGameOver) { manager.state = GameManagerState.WAIT_TO_REVEAL_ENDGAME; } else { manager.state = GameManagerState.WAIT_FOR_PLAYER_READY; } } }
@Override public void update(GameManager manager) { if (manager.allPlayersReady()) { GameInfo gameInformation = manager.game.advanceAndGetState(); // We can only wait for a choice to be played if there is a choice manager.isChoicePlayed = gameInformation.getChoices().isEmpty(); // Unready the current player for the next state Player currentPlayer = manager.players.get(gameInformation.getPlayerColor()); // Send the game information to everyone for (Player player : manager.players.values()) { player.updateGameInfo(gameInformation, currentPlayer == player); } manager.unreadyPlayer(currentPlayer); manager.state = GameManagerState.WAIT_TO_REVEAL_DICE; } }