Beispiel #1
0
        /// <summary>Update the scenario logic.</summary>
        public void Update()
        {
            if (!m_Pause)
            {
                for (int i = 0; i < m_ActionThreads.Count;)
                {
                    m_ActionThreads[i].ProcessAction();

                    if (m_ActionThreads[i].isFinished)
                    {
                        m_ActionThreads.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }
                }
                for (int i = 0; i < m_ConditionThreads.Count;)
                {
                    ConditionThread ct  = m_ConditionThreads[i];
                    bool?           res = ct.Check();

                    if (res != null)
                    {
                        m_ConditionThreads.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }

                    if (res == true)
                    {
                        ct.Pass();
                    }
                    else if (res == false)
                    {
                        ct.Fail();
                    }
                }
            }
        }
        public static ConditionThread Create(Trigger trigger)
        {
            ConditionThread ct = new ConditionThread();

            ct.trigger = trigger;

            bool?res = ct.Check();

            if (res == true)
            {
                ct.Pass();
            }
            else if (res == false)
            {
                ct.Fail();
            }
            else
            {
                ct.Register();
            }
            return(ct);
        }
Beispiel #3
0
 internal void StartProcessCondition()
 {
     ConditionThread.Create(this);
 }
Beispiel #4
0
 internal void AddConditionThread(ConditionThread thread)
 {
     m_ConditionThreads.Add(thread);
 }