Ejemplo n.º 1
0
        public void Update(double dt)
        {
            foreach (var elem in m_callStack)
            {
                elem.Task.Update(dt);
            }

            if (m_callStack.Count() != 0)
            {
                int        lastIndex = m_callStack.Count() - 1;
                _StackData lastElem  = m_callStack[lastIndex];
                if (lastElem.Process.MoveNext())
                {
                    // has next element
                    CoroutineTask newTask = lastElem.Process.Current;
                    if (newTask != null)
                    {
                        // stack new sub-coroutine
                        m_callStack.Add(new _StackData()
                        {
                            Process = newTask.Execute(), Task = newTask
                        });
                    }
                }
                else
                {
                    // finish current coroutine
                    m_callStack.RemoveAt(lastIndex);
                }
            }
        }
Ejemplo n.º 2
0
        public static CoroutineTask Join(CoroutineTask task1, CoroutineTask task2)
        {
            var result = new JoinedTask();

            result.Add(task1);
            result.Add(task2);
            return(result);
        }
Ejemplo n.º 3
0
 public void Start(CoroutineTask task)
 {
     Stop();
     m_callStack.Add(new _StackData()
     {
         Process = task.Execute(), Task = task
     });
 }
Ejemplo n.º 4
0
 public static CoroutineTask Join(CoroutineTask task1)
 {
     return(task1);
 }
Ejemplo n.º 5
0
 public void Add(CoroutineTask task)
 {
     m_list.Add(task);
 }