protected virtual void OnExit(AIAgent agent) { }
protected override void OnEnter(AIAgent agent) { m_chosenChild = ChooseRandomChild(); }
protected abstract BehaviourNodeStatus OnExecute(AIAgent agent);
protected virtual void OnEnter(AIAgent agent) { }
protected override void OnEnter(AIAgent agent) { m_currentIteration = 0; }
public virtual void OnStart(AIAgent agent) { }
public bool OnExecute(AIAgent agent) { bool result = Evaluate(agent); return(InvertResult ? !result : result); }
public virtual void OnExit(AIAgent agent) { }
protected override void OnEnter(AIAgent agent) { m_currentChild = 0; }
public override void OnStart(AIAgent agent) { base.OnStart(agent); m_numberOfExecutions = 0; }
public virtual void OnStart(AIAgent agent) { this.SceneObject = agent.SceneObject; }
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); }
public abstract void OnExecute(AIAgent agent);
protected override void OnEnter(AIAgent agent) { m_startTime = Time.time; }
protected abstract bool Evaluate(AIAgent agent);
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); }
public virtual void OnEnter(AIAgent agent) { }