Beispiel #1
0
        private void CommonUpdate()
        {
            currentTime += ReCoroutineManager.GetDeltaTime(this);

            if (!IsWaiting())
            {
                if (!e.MoveNext())
                {
                    isDone = true;
                }
                Wait(e.Current);

                if (e.Current.Equals(float.NaN))
                {
                    waitingCoroutine = replaceCoroutine;
                }
            }
            else
            {
                if (waitingCoroutine != null && waitingCoroutine.isDone)
                {
                    waitingCoroutine = null;
                }
            }
        }
Beispiel #2
0
        public static float GetDeltaTime(ReCoroutine coroutine)
        {
            switch (coroutine.coroutineType)
            {
            case CoroutineType.Update:
                return(updateDeltaTime);

            case CoroutineType.LateUpdate:
                return(lateUpdateDeltaTime);

            case CoroutineType.FixedUpdate:
                return(fixedUpdateDeltaTime);

            default:
                return(0);
            }
        }
Beispiel #3
0
        private ReCoroutine _AddCoroutine(IEnumerator <float> e, CoroutineType type = CoroutineType.Update)
        {
            var cor = new ReCoroutine(e, type);

            if (type == CoroutineType.Update)
            {
                updateIEnumeratorList.Add(cor);
            }
            else if (type == CoroutineType.LateUpdate)
            {
                lateUpdateIEnumeratorList.Add(cor);
            }
            else if (type == CoroutineType.FixedUpdate)
            {
                fixedUpdateIEnumeratorList.Add(cor);
            }

            return(cor);
        }
Beispiel #4
0
 /// <summary>
 /// 等待其他协程
 /// </summary>
 /// <param name="coroutine"></param>
 /// <returns></returns>
 public static float Wait(ReCoroutine coroutine)
 {
     lock (lockObject)
         replaceCoroutine = coroutine;
     return(float.NaN);
 }