// attempt to exit this state
 public virtual void Exit(GameState nextState)
 {
     // check to see if we actually need to exit
     if (nextState.StateOnPath(this))
     {
         return;
     }
     // have the parent exit as well if necessary
     if (ParentState != null)
     {
         ParentState.Exit(nextState);
     }
     ConfirmExitState();
 }
Example #2
0
 // exit state behaviour
 public virtual void Exit(AIState nextState)
 {
     // if this state is on the next state's path, ignore
     if (nextState?.IsOnMyPath(this) ?? false)
     {
         return;
     }
     // Exit the parent state, if available
     if (ParentState != null)
     {
         ParentState.Exit(nextState);
         ParentState.OnReadyToTransitionState -= SetReadyToTransition;
     }
     OnExit();
 }