示例#1
0
 public virtual void TryExit(IAIState 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.TryExit(nextState);
     }
     OnExit();
 }
示例#2
0
 public bool IsStateOnPath(IAIState 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));
 }