Example #1
0
    /// <summary>
    /// Returns true if and only if the candidate event is higher
    /// priority than both the running and next pending event, if any
    /// </summary>
    internal RunStatus IsElegible(BehaviorEvent candidate)
    {
        //  Debug.Log("start");



        if (this.CurrentEvent != null && pendingEvent != candidate &&
            BehaviorEvent.ComparePriority(candidate, this.CurrentEvent) <= 0)
        {
            //    Debug.Log("fail 1");
            //  Debug.Log("candidate " + candidate.Priority + " " + this.CurrentEvent.Priority);

            return(RunStatus.Failure);
        }

        if (this.pendingEvent != null && pendingEvent != candidate &&
            BehaviorEvent.ComparePriority(candidate, this.pendingEvent) <= 0)
        {
            //Debug.Log("fail 2 " + candidate.Priority + " " + this.pendingEvent.Priority + " ");

            return(RunStatus.Failure);
        }

        //  Debug.Log("success");

        return(RunStatus.Success);
    }
    /// <summary>
    /// Returns true if and only if the candidate event is higher
    /// priority than both the running and next pending event, if any
    /// </summary>
    public bool EventElegible(BehaviorEvent candidate)
    {
        if (this.CurrentEvent != null &&
            BehaviorEvent.ComparePriority(candidate, this.CurrentEvent) <= 0)
        {
            return(false);
        }

        if (this.pendingEvent != null &&
            BehaviorEvent.ComparePriority(candidate, this.pendingEvent) <= 0)
        {
            return(false);
        }

        return(true);
    }
Example #3
0
    /// <summary>
    /// Returns true if and only if the candidate event is higher
    /// priority than both the running and next pending event, if any
    /// </summary>
    internal RunStatus IsElegible(BehaviorEvent candidate)
    {
        if (this.CurrentEvent != null && pendingEvent != candidate &&
            BehaviorEvent.ComparePriority(candidate, this.CurrentEvent) <= 0)
        {
            return(RunStatus.Failure);
        }

        if (this.pendingEvent != null && pendingEvent != candidate &&
            BehaviorEvent.ComparePriority(candidate, this.pendingEvent) <= 0)
        {
            return(RunStatus.Failure);
        }

        return(RunStatus.Success);
    }