Exemplo n.º 1
0
    /// <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);
    }
Exemplo n.º 2
0
 public void StopBehavior()
 {
     if (InEvent)
     {
         g_BehaviorObject.FinishEvent();
     }
     g_BehaviorObject.StopBehavior();
     g_NPCController.Body.StopAllMotion();
 }
Exemplo n.º 3
0
    /// <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;
    }