Ejemplo n.º 1
0
 public virtual void Exit(AIState nextState)
 {
     // is this state on the next state's path?
     if (nextState.IsStateOnPath(this))
     {
         // if so, no need to exit this state
         return;
     }
     if (_parentState != null)
     {
         _parentState.Exit(nextState);
         _parentState.OnReadyToChangeState -= FireReadyToChangeState;
     }
     Active = false;
 }
Ejemplo n.º 2
0
 public bool IsStateOnPath(AIState state)
 {
     // is this the state?
     if (state == this)
     {
         return(true);
     }
     // have we exhausted all parents?
     if (_parentState == null)
     {
         return(false);
     }
     // ask the parent
     return(_parentState.IsStateOnPath(state));
 }