Exemple #1
0
 protected virtual void OnExit(AIAgent agent)
 {
 }
 protected override void OnEnter(AIAgent agent)
 {
     m_chosenChild = ChooseRandomChild();
 }
Exemple #3
0
 protected abstract BehaviourNodeStatus OnExecute(AIAgent agent);
Exemple #4
0
 protected virtual void OnEnter(AIAgent agent)
 {
 }
Exemple #5
0
 protected override void OnEnter(AIAgent agent)
 {
     m_currentIteration = 0;
 }
Exemple #6
0
 public virtual void OnStart(AIAgent agent)
 {
 }
Exemple #7
0
        public bool OnExecute(AIAgent agent)
        {
            bool result = Evaluate(agent);

            return(InvertResult ? !result : result);
        }
Exemple #8
0
 public virtual void OnExit(AIAgent agent)
 {
 }
Exemple #9
0
 protected override void OnEnter(AIAgent agent)
 {
     m_currentChild = 0;
 }
Exemple #10
0
 public override void OnStart(AIAgent agent)
 {
     base.OnStart(agent);
     m_numberOfExecutions = 0;
 }
Exemple #11
0
 public virtual void OnStart(AIAgent agent)
 {
     this.SceneObject = agent.SceneObject;
 }
Exemple #12
0
 private bool CompareUnityObject(AIAgent agent)
 {
     UnityEngine.Object value = m_firstValue.Evaluate <UnityEngine.Object>(agent.Blackboard, null);
     return((m_referenceComparison == ReferenceComparison.IsNull) ? value == null : value != null);
 }
Exemple #13
0
 public abstract void OnExecute(AIAgent agent);
Exemple #14
0
 protected override void OnEnter(AIAgent agent)
 {
     m_startTime = Time.time;
 }
Exemple #15
0
 protected abstract bool Evaluate(AIAgent agent);
Exemple #16
0
        protected override BehaviourNodeStatus OnExecute(AIAgent agent)
        {
            BehaviourNodeStatus status  = BehaviourNodeStatus.Success;
            int numberOfFailures        = 0;
            int numberOfSuccesses       = 0;
            int numberOfRunningChildren = 0;

            if (m_children.Count > 0)
            {
                for (int i = 0; i < m_children.Count; i++)
                {
                    BehaviourNodeStatus childStatus = m_children[i].Status;
                    if (childStatus == BehaviourNodeStatus.None || childStatus == BehaviourNodeStatus.Running)
                    {
                        childStatus = m_children[i].Run(agent);
                    }

                    if (childStatus == BehaviourNodeStatus.Success)
                    {
                        numberOfSuccesses++;
                    }
                    else if (childStatus == BehaviourNodeStatus.Failure)
                    {
                        numberOfFailures++;
                    }
                    else if (childStatus == BehaviourNodeStatus.Running)
                    {
                        numberOfRunningChildren++;
                    }
                }

                if ((m_failOnAny && numberOfFailures > 0) || (m_succeedOnAny && numberOfSuccesses > 0))
                {
                    if (m_failOnTie)
                    {
                        if (m_failOnAny && numberOfFailures > 0)
                        {
                            status = BehaviourNodeStatus.Failure;
                        }
                        else if (m_succeedOnAny && numberOfSuccesses > 0)
                        {
                            status = BehaviourNodeStatus.Success;
                        }
                    }
                    else
                    {
                        if (m_succeedOnAny && numberOfSuccesses > 0)
                        {
                            status = BehaviourNodeStatus.Success;
                        }
                        else if (m_failOnAny && numberOfFailures > 0)
                        {
                            status = BehaviourNodeStatus.Failure;
                        }
                    }
                }
                else
                {
                    if (numberOfSuccesses == m_children.Count)
                    {
                        status = BehaviourNodeStatus.Success;
                    }
                    else if (numberOfFailures == m_children.Count)
                    {
                        status = BehaviourNodeStatus.Failure;
                    }
                    else
                    {
                        status = BehaviourNodeStatus.Running;
                    }
                }
            }

            return(status);
        }
Exemple #17
0
 public virtual void OnEnter(AIAgent agent)
 {
 }