Пример #1
0
        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;
            }
        }
Пример #2
0
 protected virtual void Reset()
 {
     Stop();
     state = State.NotStarted;
     if (stateMachine != null)
     {
         stateMachinePool.Release(stateMachine);
         stateMachine = null;
     }
     parent  = null;
     manager = null;
 }
Пример #3
0
 /// <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;
 }