Пример #1
0
        public override void SetSceneState(int sceneState)
        {
            GameState gameState         = (GameState)sceneState;
            var       prevLogicProvider = _curLogicProvider;

            _curLogicProvider = _logicProvidersByGameState[gameState];

            if (prevLogicProvider != null)            //todo v2: do we need this if statement? seems like prevLogicProvider is never null
            {
                prevLogicProvider.ClearInputStates(); //we don't want old input states to still be active when we switch back to the original logic provider
                prevLogicProvider.OnDeActivate();
            }

            _curLogicProvider.OnActivate();
        }
Пример #2
0
        //todo v2: move SetSceneState into base class. This also means you have to move _curLogicProvider and _logicProvidersByGameState into the base class, and make _logicProvidersByGameState have an int key
        public override void SetSceneState(int sceneState)
        {
            MenuState menuState = (MenuState)sceneState;

            var prevLogicProvider = _curLogicProvider;

            _curLogicProvider = _logicProvidersByState[menuState];

            if (prevLogicProvider != null)
            {
                prevLogicProvider.ClearInputStates(); //we don't want old input states to still be active when we switch back to the original logic provider
                prevLogicProvider.OnDeActivate();
            }

            _curLogicProvider.OnActivate();
        }