protected void SetParent(RoutineBase newParent) { if (parent == newParent) { return; } if (parent != null) { Assert.IsTrue(parent.children.Contains(this)); parent.children.Remove(this); } parent = newParent; if (newParent != null) { manager = parent.manager; newParent.children.Add(this); } else { manager = null; } }
protected virtual void Reset() { Stop(); state = State.NotStarted; if (stateMachine != null) { stateMachinePool.Release(stateMachine); stateMachine = null; } parent = null; manager = null; }
/// <summary> Assign a manager and stop handler to a routine. </summary> public void SetManager(RoutineManager manager, Action <Exception> onStop) { SetParent(null); this.manager = manager; this.onStop = onStop; }