Example #1
0
        public GameStateManager(MainGame mainGame, GraphicsDevice graphicsDevice)
        {
            gameStates = new Dictionary<StateType, GameState>();
            gameStates[StateType.MENU] = new MenuState(this);
            gameStates[StateType.LOBBY] = new LobbyState(this);
            gameStates[StateType.CONTROLS] = new ControlsState(this);
            gameStates[StateType.OPTIONS] = new OptionsState(this);
            gameStates[StateType.WINSCREEN] = new WinScreenState(this);
            gameStates[StateType.TIESCREEN] = new TieScreenState(this);
            gameStates[StateType.GAME] = new GameplayState(this, graphicsDevice);

            currentState = gameStates[StateType.MENU];

            screenTransition = new Drawing.ScreenTransitionInOut();
            toTransitionNext = StateType.NONE;
            stateTransitioningTo = StateType.NONE;

            this.mainGame = mainGame;
        }
Example #2
0
        public void SwapState(StateType state)
        {
            //Don't transition to nothing
            if (state == StateType.NONE) return;

            if (currentState != null)
            {
                currentState.Exit();
            }

            Managers.ParticleManager.ClearAll();

            currentState = gameStates[state];

            currentState.Enter();
        }