Пример #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;
        }
      }
Пример #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;
        }
      }
Пример #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;
        }
      }
Пример #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;
        }
      }