static private OnApplicationPause ( bool paused ) : void | ||
paused | bool | |
Результат | void |
void Update() { if (!pumpIsRunning) { return; // Abort } // Check for pause: if ((!isPaused && Time.timeScale == 0) || (isPaused && Time.timeScale != 0)) { instance.OnApplicationPause(Time.timeScale == 0); } #if !USE_DELTA_TIME time = Time.realtimeSinceStartup; elapsed = (time - startTime) * _timeScale; startTime = time; #endif cur = head; while (cur != null) { next = (ISpriteAnimatable)cur.next; #if !USE_DELTA_TIME cur.StepAnim(elapsed); #else cur.StepAnim(Time.deltaTime); #endif cur = next; } }
/* * void Update() * { * if(!pumpIsRunning) * return; // Abort * * cur = head; * * while(cur != null) * { * cur.StepAnim(Time.deltaTime); * cur = cur.next; * } * } */ // The coroutine that drives animation: protected static IEnumerator AnimationPump() { #if !USE_DELTA_TIME startTime = Time.realtimeSinceStartup; #else startTime = Time.time; #endif float elapsed; ISpriteAnimatable next; pumpIsDone = false; while (pumpIsRunning) { // Check for pause: if ((!isPaused && Time.timeScale == 0) || (isPaused && Time.timeScale != 0)) { instance.OnApplicationPause(Time.timeScale == 0); } #if !PUMP_EVERY_FRAME yield return(new WaitForSeconds(animationPumpInterval)); #else yield return(null); #endif #if USE_DELTA_TIME time = Time.time; elapsed = time - startTime; startTime = time; #else time = Time.realtimeSinceStartup; elapsed = time - startTime; startTime = time; #endif // Start at the beginning: cur = head; while (cur != null) { next = (ISpriteAnimatable)cur.next; cur.StepAnim(elapsed); cur = next; } } pumpIsDone = true; }