public GameStateMachine(GameManager manager)
    {
        states = new Dictionary <GameState, GameState_Base <GameState> > ();

        GameState_Loading loading = new GameState_Loading(manager);
        GameState_InGame  inGame  = new GameState_InGame(manager);
        GameState_Exit    exit    = new GameState_Exit(manager);

        states.Add(loading.State, (GameState_Base <GameState>)loading);
        states.Add(inGame.State, (GameState_Base <GameState>)inGame);
        states.Add(exit.State, (GameState_Base <GameState>)exit);

        currentState = loading;
        currentState.Start();

        prevGameState = new List <GameState> ();
        prevGameState.Add(currentState.State);

        manager.BeginStateUpdate();
    }
Beispiel #2
0
        public static State CreateState(GameStateType type, State parent)
        {
            State subState = null;

            switch (type)
            {
            case GameStateType.GST_Invaild:
                break;

            case GameStateType.GST_Main:
                subState = new GameState_Main((int)GameStateType.GST_Main, parent);
                break;

            case GameStateType.GST_Loading:
                subState = new GameState_Loading((int)GameStateType.GST_Loading, parent);
                break;

            case GameStateType.GST_Update:
                subState = new GameState_Update((int)GameStateType.GST_Update, parent);
                break;

            case GameStateType.GST_Logo:
                subState = new GameState_Logo((int)GameStateType.GST_Logo, parent);
                break;

            case GameStateType.GST_Login:
                subState = new GameState_Login((int)GameStateType.GST_Login, parent);
                break;

            case GameStateType.GST_Lobby:
                subState = new GameStage_Lobby((int)GameStateType.GST_Lobby, parent);
                break;

            default:
                break;
            }
            return(subState);
        }