コード例 #1
0
ファイル: Game.cs プロジェクト: m-rogalski90/TwitchIRCClient
        /// <summary>
        /// Used to start the game. Game starts with the GameState added first
        /// and when this state ends it jumps to another in the list.
        /// </summary>
        public void StartGame()
        {
            if (m_States == null)
                throw new Exception("States wasn't initialized.");

            if (m_States.Count == 0)
                throw new Exception("States list is empty");

            m_CurrentState = m_States[0];
            StartState();
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: m-rogalski90/TwitchIRCClient
 /// <summary>
 /// Used to add a GameState object to the game
 /// </summary>
 /// <param name="state">GameState you want to add</param>
 public void AddState(GameState state)
 {
     m_States.Add(state);
 }
コード例 #3
0
ファイル: Game.cs プロジェクト: m-rogalski90/TwitchIRCClient
 /// <summary>
 /// Used to remove the GameState from the game
 /// </summary>
 /// <param name="state">GameState object that you want to remove</param>
 public void RemoveState(GameState state)
 {
     m_States.Remove(state);
 }
コード例 #4
0
ファイル: Game.cs プロジェクト: m-rogalski90/TwitchIRCClient
 /// <summary>
 /// Must be called by the GameState to inform the game that 
 /// the new state should be started.
 /// </summary>
 public void StateEnded()
 {
     m_CurrentState.CleanUp();
     if (m_CurrentState is RepetetiveState)
     {
         if (((RepetetiveState)m_CurrentState).CheckCondition())
         {
             ((RepetetiveState)m_CurrentState).StartState();
             return;
         }
     }
     m_CurrentState = NextState();
     StartState();
 }