IEnumerator InternalCoroutine(RoutineData data) { Flow f = data.flow; parentNode.SetStatus(NodeCanvas.Framework.Status.Running); if (onStart != null) { onStart.Call(f); } f.BeginBreakBlock(() => { BreakAll(true); }); while (data.enumerator.MoveNext()) { while (!parentNode.graph.didUpdateLastFrame) { yield return(null); } if (onUpdate != null) { onUpdate.Call(f); } yield return(data.enumerator.Current); } f.EndBreakBlock(); parentNode.SetStatus(NodeCanvas.Framework.Status.Resting); onFinish.Call(f); currentCoroutine = null; if (routineQueue != null && routineQueue.Count > 0) { var next = routineQueue.Dequeue(); currentCoroutine = parentNode.StartCoroutine(InternalCoroutine(next)); } }
IEnumerator DoRepeat(FlowOutput fStart, FlowOutput fUpdate, FlowOutput fFinish, Flow f) { fStart.Call(f); f.BeginBreakBlock(() => { active = false; }); while (active) { while (!graph.didUpdateLastFrame) { yield return(null); } fUpdate.Call(f); yield return(null); } f.EndBreakBlock(); fFinish.Call(f); }
IEnumerator DoWhile(FlowOutput fUpdate, FlowOutput fFinish, Flow f, ValueInput <bool> condition) { var active = true; f.BeginBreakBlock(() => { active = false; }); while (active && condition.value) { while (!graph.didUpdateLastFrame) { yield return(null); } fUpdate.Call(f); yield return(null); } coroutine = null; f.EndBreakBlock(); fFinish.Call(f); }