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() { // 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(); }