waitForSeconds() public static method

causes a Coroutine to pause for the specified duration. Yield on Coroutine.waitForSeconds in a coroutine to use.
public static waitForSeconds ( float seconds ) : object
seconds float Seconds.
return object
Beispiel #1
0
        public override IEnumerator onBeginTransition()
        {
            // create a single pixel transparent texture so we can do our squares out to the next scene
            _overlayTexture = Graphics.createSingleColorTexture(1, 1, Color.Transparent);

            // populate squares
            yield return(Core.startCoroutine(tickEffectProgressProperty(_squaresEffect, squaresInDuration, easeType)));

            // load up the new Scene
            yield return(Core.startCoroutine(loadNextScene()));

            // dispose of our previousSceneRender. We dont need it anymore.
            previousSceneRender.Dispose();
            previousSceneRender = null;

            // delay
            yield return(Coroutine.waitForSeconds(delayBeforeSquaresInDuration));

            // unpopulate squares
            yield return(Core.startCoroutine(tickEffectProgressProperty(_squaresEffect, squaresInDuration, EaseHelper.oppositeEaseType(easeType), true)));

            transitionComplete();

            // cleanup
            _overlayTexture.Dispose();
            Core.content.unloadEffect(_squaresEffect.Name);
        }
        public override IEnumerator onBeginTransition()
        {
            yield return(null);

            var elapsed = 0f;

            while (elapsed < duration)
            {
                elapsed        += Time.deltaTime;
                _renderScale    = Lerps.ease(scaleEaseType, maxScale, minScale, elapsed, duration);
                _renderRotation = Lerps.ease(rotationEaseType, minRotation, maxRotation, elapsed, duration);

                yield return(null);
            }

            // load up the new Scene
            yield return(Core.startCoroutine(loadNextScene()));

            // dispose of our previousSceneRender. We dont need it anymore.
            previousSceneRender.Dispose();
            previousSceneRender = null;

            yield return(Coroutine.waitForSeconds(delayBeforeMaskOut));

            elapsed = 0f;
            while (elapsed < duration)
            {
                elapsed     += Time.deltaTime;
                _renderScale = Lerps.ease(
                    EaseHelper.oppositeEaseType(scaleEaseType),
                    minScale,
                    maxScale,
                    elapsed,
                    duration);
                _renderRotation = Lerps.ease(
                    EaseHelper.oppositeEaseType(rotationEaseType),
                    maxRotation,
                    minRotation,
                    elapsed,
                    duration);

                yield return(null);
            }

            transitionComplete();
        }
Beispiel #3
0
        public override IEnumerator onBeginTransition()
        {
            // create a single pixel texture of our fadeToColor
            _overlayTexture = Graphics.createSingleColorTexture(1, 1, fadeToColor);

            var elapsed = 0f;

            while (elapsed < fadeOutDuration)
            {
                elapsed += Time.deltaTime;
                _color   = Lerps.ease(fadeEaseType, ref _toColor, ref _fromColor, elapsed, fadeOutDuration);

                yield return(null);
            }

            // load up the new Scene
            yield return(Core.startCoroutine(loadNextScene()));

            // dispose of our previousSceneRender. We dont need it anymore.
            previousSceneRender.Dispose();
            previousSceneRender = null;

            yield return(Coroutine.waitForSeconds(delayBeforeFadeInDuration));

            elapsed = 0f;
            while (elapsed < fadeInDuration)
            {
                elapsed += Time.deltaTime;
                _color   = Lerps.ease(
                    EaseHelper.oppositeEaseType(fadeEaseType),
                    ref _fromColor,
                    ref _toColor,
                    elapsed,
                    fadeInDuration);

                yield return(null);
            }

            transitionComplete();
            _overlayTexture.Dispose();
        }