コード例 #1
0
        /// <summary>
        /// Restarts the game, with a new ordered deck.
        /// </summary>
        /// <param name="nPlayers">The number of players in the game (default is 2 players).</param>
        public void Restart(int nPlayers = 2)
        {
            if (nPlayers < 2 || nPlayers > MaxNumberOfPlayers)
            {
                throw new Exception(nPlayers.ToString() + " Players!  Number of players must be between 2 and " + MaxNumberOfPlayers + ".");
            }
            m_Deck        = new kb52CardDeck(m_Rand);
            m_Players     = new kbCardHand[nPlayers];
            m_ThrownCards = new kbCardHand[nPlayers];
            for (int i = 0; i < nPlayers; i++)
            {
                m_Players[i]     = new kbCardHand(m_Rand);
                m_ThrownCards[i] = new kbCardHand(m_Rand);
            }
            m_MostRecentlyWonCards = new kb52CardDeck(m_Rand);
            m_MostRecentWinners    = new List <int>();

            m_State = GameState.eNotStarted;

            m_Counters = new GameCounters();
        }
コード例 #2
0
ファイル: kbWarGame.cs プロジェクト: kevinabrandon/kbWar
        /// <summary>
        /// Restarts the game, with a new ordered deck.
        /// </summary>
        /// <param name="nPlayers">The number of players in the game (default is 2 players).</param>
        public void Restart(int nPlayers = 2)
        {
            if (nPlayers < 2 || nPlayers > MaxNumberOfPlayers) throw new Exception(nPlayers.ToString() + " Players!  Number of players must be between 2 and " + MaxNumberOfPlayers + ".");
            m_Deck = new kb52CardDeck(m_Rand);
            m_Players = new kbCardHand[nPlayers];
            m_ThrownCards = new kbCardHand[nPlayers];
            for (int i = 0; i < nPlayers; i++)
            {
                m_Players[i] = new kbCardHand(m_Rand);
                m_ThrownCards[i] = new kbCardHand(m_Rand);
            }
            m_MostRecentlyWonCards = new kb52CardDeck(m_Rand);
            m_MostRecentWinners = new List<int>();

            m_State = GameState.eNotStarted;

            m_Counters = new GameCounters();
        }