Exemplo n.º 1
0
        private void SwitchState(GameStateType stateType)
        {
            switch (stateType)
            {
            case GameStateType.MainMenu:
                if (!Object.ReferenceEquals(ActiveState, MainMenu.GetInstance()))
                {
                    ActiveState = MainMenu.GetInstance();
                }
                break;

            case GameStateType.GameRunning:
                if (!Object.ReferenceEquals(ActiveState, GameRunning.GetInstance()))
                {
                    ActiveState = GameRunning.GetInstance();
                }

                break;

            case GameStateType.GamePaused:
                if (!Object.ReferenceEquals(ActiveState, GamePaused.GetInstance()))
                {
                    ActiveState = GamePaused.GetInstance();
                }

                break;
            }
        }
Exemplo n.º 2
0
 public static GameRunning GetInstance()
 {
     return(GameRunning.instance ?? (GameRunning.instance = new GameRunning()));
 }