Beispiel #1
0
        public void TriggerTransition(Transition transition)
        {
            State nextStateId = _currentState.GetNextState(transition);

            if (nextStateId != State.NoState)
            {
                BaseGameState nextState = null;
                if (_gameStates.TryGetValue(nextStateId, out nextState))
                {
                    _currentState.OnExitState();
                    _currentState = nextState;
                    _currentState.OnEnterState();
                }
                else
                {
                    Debug.LogError("Trying to transition to an uncreated state: " + nextStateId.ToString());
                }
            }
        }