コード例 #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;
        }
コード例 #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;
            }
        }
コード例 #3
0
ファイル: GamePaused.cs プロジェクト: taimhassouni/SU7
 public static GamePaused GetInstance()
 {
     return(GamePaused.instance ?? (GamePaused.instance = new GamePaused()));
 }