Exemplo n.º 1
0
        private void CommonUpdate()
        {
            CurrentTime += ReCoroutineManager.GetDeltaTime(this);

            // 1.是否处于等待
            if (!IsWaiting())
            {
                // 2.判断是否结束
                if (!Ie.MoveNext())
                {
                    IsDone = true;
                }
                // 3.更新等待时间
                _update_wait_time(Ie.Current);

                if (Ie.Current.Equals(float.NaN))
                {
                    WaitingCoroutine = ReplaceCoroutine;
                }
            }
            else
            {
                if (WaitingCoroutine != null && WaitingCoroutine.IsDone)
                {
                    WaitingCoroutine = null;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 间隔时间
        /// </summary>
        public static float GetDeltaTime(ReCoroutine coroutine)
        {
            switch (coroutine.ECoroutineType)
            {
            case E_CoroutineType.Update:
                return(UpdateDeltaTime);

            case E_CoroutineType.LateUpdate:
                return(LateUpdateDeltaTime);

            case E_CoroutineType.FixedUpdate:
                return(FixedUpdateDeltaTime);

            default:
                return(0);
            }
        }
Exemplo n.º 3
0
        public ReCoroutine _internal_add_coroutine(IEnumerator <float> e, E_CoroutineType type = E_CoroutineType.Update)
        {
            ReCoroutine cor = new ReCoroutine(e, type);

            if (type == E_CoroutineType.Update)
            {
                _updateIenumeratorList.Add(cor);
            }
            else if (type == E_CoroutineType.LateUpdate)
            {
                _lateUpdateIenumeratorList.Add(cor);
            }
            else if (type == E_CoroutineType.FixedUpdate)
            {
                _fixedUpdateIenumeratorList.Add(cor);
            }

            return(cor);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 等待其他协程
 /// </summary>
 public static float Wait(ReCoroutine coroutine)
 {
     lock (lock_object)
         ReplaceCoroutine = coroutine;
     return(float.NaN);
 }