Ejemplo n.º 1
0
    /// <summary>
    /// Add a player to board at position
    /// </summary>
    /// <param name="position"></param>
    public void AddPlayerToBoard(int position)
    {
        if (m_currentResult == GameResult.None)
        {
            if (m_board.AddPlayerToBoard(position, m_board.CurrentPlayer))
            {
                int playerIndex = 0;
                for (int i = 0; i < players.Count; i++)
                {
                    if (players[i] == m_board.CurrentPlayer)
                    {
                        playerIndex = i;
                    }
                }

                m_boardView.AddedPlayerToBoard(playerIndex);
                m_boardView.UpdateView();

                // check end of game
                CheckAndResolveEndGame();
            }
        }
    }