Ejemplo n.º 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();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        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);
        }