Exemplo n.º 1
0
 private void OnReadyToChangeState(IAIState nextState)
 {
     _currentState.OnReadyToTransition -= OnReadyToChangeState;
     _currentState?.TryExit(nextState);
     _currentState = nextState;
     _currentState.OnReadyToTransition += OnReadyToChangeState;
     _currentState?.TryEnter();
 }
Exemplo n.º 2
0
 protected virtual void OnEnter()
 {
     // Debug.Log($"[{_character.GameObject.name}]: Entering state \'{Id}\'...");
     // attempt to enter the parent as well
     if (_parentState != null)
     {
         if (!_parentState.Active)
         {
             _parentState.TryEnter();
         }
         _parentState.OnReadyToTransition += OnParentStateReadyToTransition;
     }
     Active = true;
 }
Exemplo n.º 3
0
 public void StartStateMachine()
 {
     _currentState = _startingState;
     _currentState.OnReadyToTransition += OnReadyToChangeState;
     _currentState.TryEnter();
 }