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

            return(InvertResult ? !result : result);
        }
Ejemplo n.º 8
0
 public virtual void OnExit(AIAgent agent)
 {
 }
Ejemplo n.º 9
0
 protected override void OnEnter(AIAgent agent)
 {
     m_currentChild = 0;
 }
Ejemplo n.º 10
0
 public override void OnStart(AIAgent agent)
 {
     base.OnStart(agent);
     m_numberOfExecutions = 0;
 }
Ejemplo n.º 11
0
 public virtual void OnStart(AIAgent agent)
 {
     this.SceneObject = agent.SceneObject;
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 13
0
 public abstract void OnExecute(AIAgent agent);
Ejemplo n.º 14
0
 protected override void OnEnter(AIAgent agent)
 {
     m_startTime = Time.time;
 }
Ejemplo n.º 15
0
 protected abstract bool Evaluate(AIAgent agent);
Ejemplo n.º 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);
        }
Ejemplo n.º 17
0
 public virtual void OnEnter(AIAgent agent)
 {
 }