private void StartTask(Node node) { _aliveBehavior = node; if (node is Task) { RuntimeTask rt = GetRuntimeTask(_aliveBehavior as Task); rt.Start(); } }
public void StartNode(Node node) { _aliveBehavior = node; if (node.decorators.Length > 0) { for (int i = 0; i < node.decorators.Length; i++) { RuntimeDecorator rd = GetRuntimeDecorator(node.decorators[i]); #if UNITY_EDITOR rd.closed = false; #endif if (!StartDecorator(rd)) { FinishExecute(false); return; } } } if (node is Task) { StartTask(node); } else { if (node is Composite) { if ((node as Composite).services.Length > 0) { for (int i = 0; i < _runtimeServices.Count; i++) if (_runtimeServices[i].parent == node as Composite) StartService(_runtimeServices[i]); } if (node.childNodes.Length == 0) { if (node is Selector) FinishExecute(true); else if (node is Sequence) FinishExecute(false); } } if (_currentChildNodeIndex[node] < node.childNodes.Length) StartNode(node.childNodes[_currentChildNodeIndex[node]]); } }
private void OnDisable() { _aliveBehavior = null; }
private void FinishExecuteImmediate() { FinishDecorators(); if (_aliveBehavior is Composite) FinishComposite(_aliveBehavior as Composite); FinishTask(); _aliveBehavior = _aliveBehavior.parentNode; }