public virtual void ResetOutputStates(GameObject invoker, Behavior behavior, bool caller) { behavior.SetState(this.GetInstanceID(), Return.None); if (!caller) { behavior.SetPassCount(this.GetInstanceID(), 0); } for (int i = 0; i < this.outputs.Count; ++i) { this.outputs[i].ResetOutputStates(invoker, behavior, false); } }
// VIRTUAL METHODS: ----------------------------------------------------------------------- public override Node.Return Execute(Node node, GameObject invoker, Behavior behavior) { int instanceID = node.GetInstanceID(); int passCount = behavior.GetPassCount(instanceID); if (this.count <= 0 || passCount < this.count) { Node.Return result = base.Execute(node, invoker, behavior); if (result == Node.Return.Success || result == Node.Return.Fail) { behavior.SetPassCount(instanceID, passCount + 1); node.ResetOutputStates(invoker, behavior, true); } return(Node.Return.Running); } return(Node.Return.Success); }
// VIRTUAL METHODS: ----------------------------------------------------------------------- public override Node.Return Execute(Node node, GameObject invoker, Behavior behavior) { int instanceID = node.GetInstanceID(); int passCount = behavior.GetPassCount(instanceID); if (passCount > 0) { return(behavior.GetState(instanceID)); } Node.Return result = base.Execute(node, invoker, behavior); switch (result) { case Node.Return.Fail: case Node.Return.Success: behavior.SetPassCount(instanceID, passCount + 1); return(result); } return(Node.Return.Running); }