Esempio n. 1
0
        private void GoToState(EAnimalState stateType)
        {
            if (_stateBehaviours.ContainsKey(stateType))
            {
                _currentStateBehaviour?.OnStateExit();

                _currentStateBehaviour = _stateBehaviours[stateType];

                _currentStateBehaviour.OnStateEnter();
            }
        }
        private void GoToStateInternal(int stateType)
        {
            if (StateBehaviours.ContainsKey(stateType))
            {
                CurrentStateBehaviour?.OnStateExit();
                CurrentStateBehaviour = StateBehaviours[stateType];

                CurrentStateBehaviour.OnStateEnter();
            }
            else
            {
                Debug.LogError($"State Id[{stateType}] doesn't Exist in the Dictionary.");
            }
        }