Example #1
0
        public void PopSubState()
        {
            SubGameState previousState = _currentSubGameState;

            _currentSubGameState = null;

            if (null != previousState)
            {
                previousState.OnExit();

                // TODO: this should disable the state rather than destroying it
                Destroy(previousState.gameObject);
            }

            _currentSubGameState = _subStateStack.Count > 0 ? _subStateStack.Pop() : null;

            if (null != _currentSubGameState)
            {
                _currentSubGameState.OnResume();
            }
            else if (null != _currentGameState)
            {
                _currentGameState.OnResume();
            }
        }
Example #2
0
        public void PopSubState()
        {
            SubGameState previousState = (SubGameState)_currentGameState;

            _currentGameState = null;

            previousState?.OnExit();
            Destroy(previousState?.gameObject);

            _currentGameState = _stateQueue.Count > 0 ? _stateQueue.Dequeue() : null;
        }
Example #3
0
        public void PopSubState()
        {
            SubGameState previousState = (SubGameState)_currentGameState;

            _currentGameState = null;

            if (null != previousState)
            {
                previousState.OnExit();
                Destroy(previousState.gameObject);
            }

            _currentGameState = _stateStack.Count > 0 ? _stateStack.Pop() : null;
            _currentGameState?.OnResume();
        }