示例#1
0
        public override void Update(GameTime gameTime)
        {
            if (inputManager.MouseReleased != MouseButtons.None || inputManager.KeysPressed.Any(x => x == Keys.Enter))
            {
                Next();
                return;
            }

            this.elapsed          += gameTime.Elapsed;
            this.alphaBackground   = 1 - EaseHelper.Cubic(elapsed.TotalMilliseconds / fadeTimeBackground.TotalMilliseconds);
            this.alphaTeuz         = EaseHelper.Cubic(elapsed.TotalMilliseconds / fadeTimeLogo.TotalMilliseconds);
            this.alphaTowerDefence = EaseHelper.Cubic(
                (elapsed - fadeTimeLogo - timeBetweenLogoAndTowerDefence).TotalMilliseconds /
                fadeTimeTowerDefence.TotalMilliseconds
                );

            if (alphaTowerDefence > 0)
            {
                this.alphaTeuz      -= this.alphaTowerDefence;
                this.alphaBackground = this.alphaTowerDefence;
            }

            if (elapsed > totalLifetime)
            {
                Next();
            }
        }
示例#2
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);
        }
示例#3
0
        public static void EaseValue(PlaneProjection current, PlaneProjection startValue, PlaneProjection endValue, double percent)
        {
            if (current.RotationX != endValue.RotationX)
            {
                current.RotationX = EaseHelper.EaseValue(startValue.RotationX, endValue.RotationX, percent);
            }
            if (current.RotationY != endValue.RotationY)
            {
                current.RotationY = EaseHelper.EaseValue(startValue.RotationY, endValue.RotationY, percent);
            }
            if (current.RotationZ != endValue.RotationZ)
            {
                current.RotationZ = EaseHelper.EaseValue(startValue.RotationZ, endValue.RotationZ, percent);
            }
            if (current.LocalOffsetX != endValue.LocalOffsetX)
            {
                current.LocalOffsetX = EaseHelper.EaseValue(startValue.LocalOffsetX, endValue.LocalOffsetX, percent);
            }
            if (current.LocalOffsetY != endValue.LocalOffsetY)
            {
                current.LocalOffsetY = EaseHelper.EaseValue(startValue.LocalOffsetY, endValue.LocalOffsetY, percent);
            }
            if (current.LocalOffsetZ != endValue.LocalOffsetZ)
            {
                current.LocalOffsetZ = EaseHelper.EaseValue(startValue.LocalOffsetZ, endValue.LocalOffsetZ, percent);
            }
            if (current.GlobalOffsetX != endValue.GlobalOffsetX)
            {
                current.GlobalOffsetX = EaseHelper.EaseValue(startValue.GlobalOffsetX, endValue.GlobalOffsetX, percent);
            }
            if (current.GlobalOffsetY != endValue.GlobalOffsetY)
            {
                current.GlobalOffsetY = EaseHelper.EaseValue(startValue.GlobalOffsetY, endValue.GlobalOffsetY, percent);
            }
            if (current.GlobalOffsetZ != endValue.GlobalOffsetZ)
            {
                current.GlobalOffsetZ = EaseHelper.EaseValue(startValue.GlobalOffsetZ, endValue.GlobalOffsetZ, percent);
            }
            if (current.CenterOfRotationX != endValue.CenterOfRotationX)
            {
                current.CenterOfRotationX = EaseHelper.EaseValue(startValue.CenterOfRotationX, endValue.CenterOfRotationX, percent);
            }
            if (current.CenterOfRotationY != endValue.CenterOfRotationY)
            {
                current.CenterOfRotationY = EaseHelper.EaseValue(startValue.CenterOfRotationY, endValue.CenterOfRotationY, percent);
            }
            if (current.CenterOfRotationZ != endValue.CenterOfRotationZ)
            {
                current.CenterOfRotationZ = EaseHelper.EaseValue(startValue.CenterOfRotationZ, endValue.CenterOfRotationZ, percent);
            }

            //  NOT TEST
            //if (current.ProjectionMatrix != endValue.ProjectionMatrix) EaseValue(current.ProjectionMatrix, startValue.ProjectionMatrix, endValue.ProjectionMatrix, percent);
        }
        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();
        }
示例#5
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();
        }
示例#6
0
        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();
        }
示例#7
0
 public static void EaseValue(DropShadowEffect current, DropShadowEffect startValue, DropShadowEffect endValue, double percent)
 {
     if (current.BlurRadius != endValue.BlurRadius)
     {
         current.BlurRadius = EaseHelper.EaseValue(startValue.BlurRadius, endValue.BlurRadius, percent);
     }
     if (current.Opacity != endValue.Opacity)
     {
         current.Opacity = EaseHelper.EaseValue(startValue.Opacity, endValue.Opacity, percent);
     }
     if (current.Color != endValue.Color)
     {
         current.Color = EaseHelper.EaseValue(startValue.Color, endValue.Color, percent);
     }
     if (current.Direction != endValue.Direction)
     {
         current.Direction = EaseHelper.EaseValue(startValue.Direction, endValue.Direction, percent);
     }
     if (current.ShadowDepth != endValue.ShadowDepth)
     {
         current.ShadowDepth = EaseHelper.EaseValue(startValue.ShadowDepth, endValue.ShadowDepth, percent);
     }
 }
示例#8
0
        public override IEnumerator OnBeginTransition()
        {
            var startAt = DateTime.Now;

            while ((DateTime.Now - startAt).TotalSeconds < this.FadeOutDuration)
            {
                var elapsed = (float)(DateTime.Now - startAt).TotalSeconds;
                this.color = Lerps.Ease(
                    this.FadeEaseType,
                    ref this.fromColor,
                    ref this.toColor,
                    elapsed,
                    this.FadeOutDuration);

                yield return(null);
            }

            this.SetNextScene();

            yield return(DefaultCoroutines.Wait(this.DelayBeforeFadeInDuration));

            startAt = DateTime.Now;
            while ((DateTime.Now - startAt).TotalSeconds < this.FadeInDuration)
            {
                var elapsed = (float)(DateTime.Now - startAt).TotalSeconds;
                this.color = Lerps.Ease(
                    EaseHelper.OppositeEaseType(this.FadeEaseType),
                    ref this.toColor,
                    ref this.fromColor,
                    elapsed,
                    this.FadeInDuration);

                yield return(null);
            }

            this.TransitionComplete();
        }
        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);

            // obscure the screen
            yield return(Core.startCoroutine(tickEffectProgressProperty(_textureWipeEffect, duration, easeType)));

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

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

            // undo the effect
            yield return(Core.startCoroutine(
                             tickEffectProgressProperty(_textureWipeEffect, duration, EaseHelper.oppositeEaseType(easeType), true)));

            transitionComplete();

            // cleanup
            _overlayTexture.Dispose();
            Core.content.unloadEffect(_textureWipeEffect);
        }
示例#10
0
 public static void EaseValue(Matrix3D current, Matrix3D startValue, Matrix3D endValue, double percent)
 {
     if (current.M11 != endValue.M11)
     {
         EaseHelper.EaseValue(startValue.M11, endValue.M11, percent);
     }
     if (current.M12 != endValue.M12)
     {
         EaseHelper.EaseValue(startValue.M12, endValue.M12, percent);
     }
     if (current.M13 != endValue.M13)
     {
         EaseHelper.EaseValue(startValue.M13, endValue.M13, percent);
     }
     if (current.M14 != endValue.M14)
     {
         EaseHelper.EaseValue(startValue.M14, endValue.M14, percent);
     }
     if (current.M21 != endValue.M21)
     {
         EaseHelper.EaseValue(startValue.M21, endValue.M21, percent);
     }
     if (current.M22 != endValue.M22)
     {
         EaseHelper.EaseValue(startValue.M22, endValue.M22, percent);
     }
     if (current.M23 != endValue.M23)
     {
         EaseHelper.EaseValue(startValue.M23, endValue.M23, percent);
     }
     if (current.M24 != endValue.M24)
     {
         EaseHelper.EaseValue(startValue.M24, endValue.M24, percent);
     }
     if (current.M31 != endValue.M31)
     {
         EaseHelper.EaseValue(startValue.M31, endValue.M31, percent);
     }
     if (current.M32 != endValue.M32)
     {
         EaseHelper.EaseValue(startValue.M32, endValue.M32, percent);
     }
     if (current.M33 != endValue.M33)
     {
         EaseHelper.EaseValue(startValue.M33, endValue.M33, percent);
     }
     if (current.M34 != endValue.M34)
     {
         EaseHelper.EaseValue(startValue.M34, endValue.M34, percent);
     }
     if (current.M44 != endValue.M44)
     {
         EaseHelper.EaseValue(startValue.M44, endValue.M44, percent);
     }
     if (current.OffsetX != endValue.OffsetX)
     {
         EaseHelper.EaseValue(startValue.OffsetX, endValue.OffsetX, percent);
     }
     if (current.OffsetY != endValue.OffsetY)
     {
         EaseHelper.EaseValue(startValue.OffsetY, endValue.OffsetY, percent);
     }
     if (current.OffsetZ != endValue.OffsetZ)
     {
         EaseHelper.EaseValue(startValue.OffsetZ, endValue.OffsetZ, percent);
     }
 }