Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
 protected virtual void Reset()
 {
     Stop();
     state = State.NotStarted;
     if (stateMachine != null)
     {
         stateMachinePool.Release(stateMachine);
         stateMachine = null;
     }
     parent  = null;
     manager = null;
 }
Exemplo n.º 3
0
 private void Setup(bool yield, RoutineBase parent)
 {
     id = nextId++;
     SetParent(parent);
     state = yield ? State.Running : State.NotStarted;
 }
Exemplo n.º 4
0
 /// <summary> Release routine back to pool. </summary>
 public static void Release(RoutineBase routine)
 {
     routine.Reset();
     pool.Release(routine);
 }