Пример #1
0
        private void OnReadyToChangeState(AIState state)
        {
            _currentState.OnReadyToChangeState -= OnReadyToChangeState;
            AIState nextState = state;

            if (_queuedAIStates.Count > 0)
            {
                nextState = _queuedAIStates.Dequeue();
            }
            _currentState?.Exit(nextState);
            _currentState = nextState;
            _currentState.OnReadyToChangeState += OnReadyToChangeState;
            _currentState?.Enter();
        }
Пример #2
0
 public virtual void Enter()
 {
     // if already active, no need to re-enter
     if (Active)
     {
         return;
     }
     _character.AnimationController?.UpdateAnimationState(_animationData);
     if (_parentState != null)
     {
         _parentState.Enter();
         _parentState.OnReadyToChangeState += FireReadyToChangeState;
     }
     Active = true;
 }
Пример #3
0
 // Start is called before the first frame update
 void Start()
 {
     _currentState.OnReadyToChangeState += OnReadyToChangeState;
     _currentState?.Enter();
 }