Example #1
0
    public override void Update()
    {
        base.Update();

        if (m_CurrentTask.IsDone() == false)
        {
            m_CurrentTask.Update();
        }
        else
        {
            if (m_CurrentTask.Success())
            {
                NextTask();
            }
            else
            {
                // One of the tasks failed so fail ourselves.
                SetComplete(false);
            }
        }
    }
Example #2
0
    public virtual void Update()
    {
        for (int i = 0; i < m_Tasks.Count; ++i)
        {
            BaseTask current = m_Tasks[i];
            if (current.IsDone() == false)
            {
                current.Update();
            }
        }

        for (int i = m_Tasks.Count - 1; i >= 0; --i)
        {
            BaseTask current = m_Tasks[i];
            if (current.IsDone() == true)
            {
                // Task complete, remove from list.
                Debug.Log("Task " + current.GetType() + " complete, removing from task list.");
                m_Tasks.RemoveAt(i);
            }
        }
    }