Example #1
0
      @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;
        }
      }
Example #2
0
      @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;
        }
      }
Example #3
0
      @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;
        }
      }
Example #4
0
      @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;
        }
      }