OnApplicationPause() static private method

static private OnApplicationPause ( bool paused ) : void
paused bool
return void
Exemplo n.º 1
0
    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;
        }
    }
Exemplo n.º 2
0
/*
 *      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;
    }