/// <summary> /// Terminates the object's current activity and gets it ready to execute /// </summary> private RunStatus Acquire(BehaviorObject obj) { // Reality check, make sure we're still the pending event if (obj.PendingEvent != this) { return(RunStatus.Failure); } // Either kill the active event or suspend the agent RunStatus result; if (obj.CurrentEvent != null) { result = obj.CurrentEvent.Yield(obj); } else { result = obj.StopBehavior(); } // If the current event is finished, clear it out if (result == RunStatus.Success) { obj.ClearEvent(); } return(result); }
public void StopBehavior() { if (InEvent) { g_BehaviorObject.FinishEvent(); } g_BehaviorObject.StopBehavior(); g_NPCController.Body.StopAllMotion(); }
/// <summary> /// Terminates the object's current activity and gets it ready to execute /// </summary> private RunStatus Acquire(BehaviorObject obj) { // Reality check, make sure we're still the pending event if (obj.PendingEvent != this) return RunStatus.Failure; // Either kill the active event or suspend the agent RunStatus result; if (obj.CurrentEvent != null) result = obj.CurrentEvent.Yield(obj); else result = obj.StopBehavior(); // If the current event is finished, clear it out if (result == RunStatus.Success) obj.ClearEvent(); return result; }