internal void _Update(float fTime, float fRealTime) { _InUpdating = true; _Time = fTime; _RealTime = fRealTime; if (__arrAddedCoroutines.Count != 0) { foreach (Coroutine addedCoroutine in __arrAddedCoroutines) { _arrCoroutines.Add(addedCoroutine); } __arrAddedCoroutines.Clear(); } ///----- int nAliveCount = _arrCoroutines.Count; Coroutine[] arrCoroutines = _arrCoroutines._Buffer; for (int i = 0; i < nAliveCount; ++i) { Coroutine pCoroutine = arrCoroutines[i]; if (pCoroutine == null) { int a = 0; a++; } Debugger.Assert(pCoroutine._bInQueue); bool bIsDead = pCoroutine._Update(pCoroutine.scalable ? fTime : fRealTime); if (bIsDead) { if (i < nAliveCount - 1) { /// Swap with last element _arrCoroutines[i] = _arrCoroutines[nAliveCount - 1]; i--; nAliveCount--; } else if (i == nAliveCount - 1) { nAliveCount--; } else { Debugger.Assert(false); } _arrCoroutines.RemoveTail(); if (pCoroutine._bPooled) { pCoroutine.DecRef(); } pCoroutine._bInQueue = false; } } _InUpdating = false; }