Esempio n. 1
0
        public StateMachine()
        {
            GalagaBus.GetBus().Subscribe(GameEventType.GameStateEvent, this);
            GalagaBus.GetBus().Subscribe(GameEventType.InputEvent, this);

            gameRunning = GameRunning.GetInstance();
            gameRunning.InitializeGameState();
            gamePaused = GamePaused.GetInstance();
            gamePaused.InitializeGameState();
            mainMenu = MainMenu.GetInstance();
            mainMenu.InitializeGameState();

            ActiveState = mainMenu;
        }
Esempio n. 2
0
        private void SwitchState(GameStateType stateType)
        {
            switch (stateType)
            {
            case GameStateType.MainMenu:
                ActiveState = MainMenu.GetInstance();
                break;

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

            case GameStateType.GameRunning:
                ActiveState = GameRunning.GetInstance();
                break;
            }
        }
Esempio n. 3
0
 public static GamePaused GetInstance()
 {
     return(GamePaused.instance ?? (GamePaused.instance = new GamePaused()));
 }