/// <summary>
        /// Swicthes state depending on which stateType given by the GameStateType.
        /// </summary>
        /// <param name="stateType">The state to switch to</param>
        private void SwitchState(GameStateType stateType)
        {
            switch (stateType)
            {
            case GameStateType.MainMenu:
                ActiveState = MainMenu.GetInstance();
                ActiveState.InitializeGameState();
                break;

            case GameStateType.Gamelevels:
                ActiveState = GameLevels.GetInstance();
                ActiveState.InitializeGameState();
                break;

            case GameStateType.GameControls:
                ActiveState = GameControls.GetInstance();
                ActiveState.InitializeGameState();
                break;

            case GameStateType.GameRunning:
                ActiveState = GameRunning.GetInstance();
                break;

            case GameStateType.GamePaused:
                ActiveState = GamePaused.GetInstance();
                ActiveState.InitializeGameState();
                break;

            case GameStateType.GameOver:
                ActiveState = GameOver.GetInstance();
                ActiveState.InitializeGameState();
                break;

            case GameStateType.GameVictory:
                ActiveState = GameVictory.GetInstance();
                ActiveState.InitializeGameState();
                break;
            }
        }
Beispiel #2
0
 /// <summary>
 ///GetInstance looks if there is any control instance. If it's not the case it returns
 /// new GameControls
 /// </summary>
 /// <returns>Either the game instance or a new if its null</returns>
 public static GameVictory GetInstance()
 {
     return(GameVictory.instance ?? (GameVictory.instance = new GameVictory()));
 }