示例#1
0
        private IEnumerator timerCoroutine()
        {
            float timeLeft = timeout;

            while (timeLeft > 0)
            {
                yield return(null);

                if (state == State.Processing)
                {
                    timeLeft -= timeManager.GetDeltaTime();
                    process(timeLeft);
                }
            }
            this.Stop();
        }
        protected virtual IEnumerator Simulate()
        {
            CurTime = 0.0f;
            simulator.Init();

            while (state != State.Stopped)
            {
                if (state != State.Paused)
                {
                    CurTime += timeManager.GetDeltaTime();

                    if (CurTime < Duration)
                    {
                        simulator.Simulate(CurTime);
                    }
                    else
                    {
                        simulator.Simulate(Duration);
                        Stop();
                    }
                }
                yield return(null);
            }
        }