Ejemplo n.º 1
0
        public override void Draw(SceneGame scene, DrawPass pass)
        {
            float size   = (float)LerpHelper.CubicIn(1, 0, Frame.Slide);
            float length = (float)LerpHelper.Linear(2, 1, Frame.Slide);
            float angle  = Util.VectorToAngle(Vector2.Lerp(Vector2.Zero, Velocity, (float)VelocityLerp(0, 1, Frame.Slide)) - Vector2.Lerp(Vector2.Zero, Velocity, (float)VelocityLerp(0, 1, Frame.Slide - 0.01)));

            scene.DrawSpriteExt(Sprite, 0, CurrentPosition - Sprite.Middle, Sprite.Middle, angle, new Vector2(1, length) * size, SpriteEffects.None, Color, 0);
        }
Ejemplo n.º 2
0
        public override void Draw(SceneGame scene, DrawPass pass)
        {
            var sprite      = SpriteLoader.Instance.AddSprite("content/effect_blood_score");
            var offsetStart = OffsetStart * (float)LerpHelper.QuadraticIn(0, 1, Frame.Slide);
            var offsetEnd   = OffsetEnd * (float)LerpHelper.QuadraticIn(1, 0, Frame.Slide);
            var position    = Vector2.Lerp(Start + offsetStart, End + offsetEnd, (float)LerpHelper.Quadratic(0, 1, Frame.Slide));

            scene.DrawSpriteExt(sprite, scene.Frame / 5, position - sprite.Middle, sprite.Middle, Angle, Vector2.One, SpriteEffects.None, new Color(215, 63, 36), 0);
        }
Ejemplo n.º 3
0
        public override void Draw(SceneGame scene, DrawPass pass)
        {
            var offset = new Vector2(0, -32 * (float)LerpHelper.QuadraticOut(0, 1, Frame.GetSubSlide(0, 20)));

            if (FlickerTime < 0.5f)
            {
                Text.Draw(Position + offset, World.FontRenderer, Matrix.CreateScale(new Vector3(2, 2, 0)));
            }
        }
Ejemplo n.º 4
0
        public static void DrawStrike(SceneGame scene, Vector2 start, Vector2 end, float slide, Color color)
        {
            var   sprite    = SpriteLoader.Instance.AddSprite("content/effect_bash");
            float angle     = Util.VectorToAngle(end - start);
            var   pos       = Vector2.Lerp(start, end, (float)LerpHelper.QuadraticIn(0.3, 1, slide));
            var   middle    = new Vector2(sprite.Width / 2, sprite.Height / 4);
            var   size      = (float)LerpHelper.CubicOut(0.3, 1, slide);
            var   lengthMod = (float)LerpHelper.CubicIn(1, 0.3, slide);

            scene.DrawSpriteExt(sprite, 0, pos - middle, middle, angle, new Vector2(1, lengthMod) * size, SpriteEffects.None, color, 0);
        }
Ejemplo n.º 5
0
        public override void Draw(SceneGame scene, DrawPass pass)
        {
            var   sprite    = SpriteLoader.Instance.AddSprite("content/effect_bash");
            float angle     = Util.VectorToAngle(End - Start);
            var   pos       = Vector2.Lerp(Start, End, (float)LerpHelper.QuadraticIn(0.3, 1, Slider.Slide));
            var   middle    = new Vector2(sprite.Width / 2, sprite.Height / 4);
            var   size      = (float)LerpHelper.CubicOut(0.3, 1, Slider.Slide);
            var   lengthMod = (float)LerpHelper.CubicIn(1, 0.3, Slider.Slide);

            scene.DrawSpriteExt(sprite, 0, pos - middle, middle, angle, new Vector2(1, lengthMod) * size, SpriteEffects.None, Color, 0);
        }
Ejemplo n.º 6
0
        public override void Draw(GameTime gameTime)
        {
            var mascot_dark = SpriteLoader.Instance.AddSprite("content/intro_mascot_dark");
            var mascot      = SpriteLoader.Instance.AddSprite("content/intro_mascot");

            Color fadeColor;

            WorldTransform = Matrix.Identity;
            Projection     = Matrix.CreateOrthographicOffCenter(0, Viewport.Width, Viewport.Height, 0, 0, -1);
            ColorMatrix colorMatrix = MascotFlash.ColorMatrix;

            PushSpriteBatch();
            PushSpriteBatch(shader: Shader, projection: Projection, shaderSetup: (transform, projection) =>
            {
                SetupColorMatrix(colorMatrix, transform, projection);
            });

            Vector2 pos = new Vector2(Viewport.Width / 2, Viewport.Height / 2);

            switch (MascotSM.CurrentState)
            {
            case MascotState.FadeIn:
                float fadeIn = MascotSM.Content.Slide;
                fadeColor = Color.Lerp(Color.Black, Color.White, (float)LerpHelper.QuadraticOut(0, 1, fadeIn));
                DrawSpriteExt(mascot_dark, AnimationFrame(mascot_dark, 0), pos - mascot_dark.Middle, mascot_dark.Middle, 0, new Vector2(2), SpriteEffects.None, fadeColor, 0);
                break;

            case MascotState.OpenEye:
                float openEye = MascotSM.Content.Slide;
                DrawSpriteExt(mascot_dark, AnimationFrame(mascot_dark, (float)LerpHelper.QuinticIn(0, 1, openEye)), pos - mascot_dark.Middle, mascot_dark.Middle, 0, new Vector2(2), SpriteEffects.None, Color.White, 0);
                break;

            case MascotState.Idle:
                var blink = SlideRepeat(MascotBlink.Slide, 2);
                DrawSpriteExt(mascot, AnimationFrame(mascot, (float)LerpHelper.QuinticIn(0, 1, blink)), pos - mascot.Middle, mascot.Middle, 0, new Vector2(2), SpriteEffects.None, Color.White, 0);
                break;

            case MascotState.FadeOut:
                float fadeOut = MascotSM.Content.Slide;
                fadeColor = Color.Lerp(Color.White, Color.Black, (float)LerpHelper.QuadraticIn(0, 1, fadeOut));
                fadeOut   = MascotSM.Content.Slide;
                DrawSpriteExt(mascot, 3, pos - mascot.Middle, mascot.Middle, 0, new Vector2(2), SpriteEffects.None, fadeColor, 0);
                break;
            }
            PopSpriteBatch();

            foreach (var visualEffect in VisualEffects)
            {
                visualEffect.Draw(this);
            }

            PopSpriteBatch();
        }
Ejemplo n.º 7
0
 private DialogParams TransformShow(DialogParams param, TextCursorPosition pos, float slide)
 {
     if (slide <= 0)
     {
         //param.Color = Color.Transparent;
         //param.Border = Color.Transparent;
     }
     else
     {
         float angle = Util.RandomNoise(pos.GlobalCharacter) * MathHelper.TwoPi;
         //param.Offset = Vector2.Lerp(Util.AngleToVector(angle) * 20, Vector2.Zero, MathHelper.Clamp(slide * 2, 0, 1));
         //param.Scale = Vector2.Lerp(new Vector2(3, 3), Vector2.One, MathHelper.Clamp(slide * 2, 0, 1));
         var colorSlide = (float)LerpHelper.ForwardReverse(1, 0, slide);
         param.Border = Color.Lerp(Color.Gold, Color.Black, colorSlide);
     }
     param.Offset = Vector2.Lerp(-pos.Position, Vector2.Zero, (float)LerpHelper.QuadraticOut(0, 1, AppearSlide.Slide));
     return(param);
 }
Ejemplo n.º 8
0
        public override void Draw(SceneGame scene, DrawPass pass)
        {
            Color color = new Color(215, 63, 36);
            float slide = Frame.GetSubSlide(Frame.EndTime * 0.9f, Frame.EndTime);

            switch (pass)
            {
            case DrawPass.BloodAdditive:
                color = Color.Lerp(Color.Gray, Color.Black, slide);
                break;

            case DrawPass.BloodMultiply:
                color = Color.Lerp(color, Color.White, (float)LerpHelper.ExponentialIn(0, 1, slide));
                break;
            }

            scene.DrawSpriteExt(Sprite, SubImage, Position - Sprite.Middle, Sprite.Middle, Angle, new Vector2(Scale), SpriteEffects.None, color, 0);
        }
Ejemplo n.º 9
0
        private void DrawText()
        {
            var textTop    = SpriteLoader.Instance.AddSprite("content/title_text_top");
            var textBottom = SpriteLoader.Instance.AddSprite("content/title_text_bottom");

            int textX = Viewport.Width / 2;
            int textY = Viewport.Height / 10 + 40;

            Vector2 offset = Vector2.Zero;

            if (TitleSM.CurrentState == TitleState.TextSlash)
            {
                float slashSlide = TitleSM.Content.Slide;
                offset = new Vector2((float)LerpHelper.QuinticOut(0, 80, slashSlide), 0);
            }
            else if (TitleSM.CurrentState == TitleState.TextArrange)
            {
                float rearrangeSlide = (float)LerpHelper.CubicIn(0, 1, TitleSM.Content.Slide);
                offset = new Vector2((float)LerpHelper.Linear(80, 0, rearrangeSlide), HalfCircle(rearrangeSlide) * -80);
            }
            else
            {
                offset = new Vector2(0, -40);
            }

            ColorMatrix flash = TextFlash.ColorMatrix;

            PushSpriteBatch(shader: Shader, shaderSetup: (transform, projection) =>
            {
                SetupColorMatrix(flash, transform, projection);
            });

            GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, Viewport.Width, textY);
            DrawSprite(textTop, 0, new Vector2(textX, textY) + offset - textTop.Middle, SpriteEffects.None, 0);
            FlushSpriteBatch();
            GraphicsDevice.ScissorRectangle = new Rectangle(0, textY, Viewport.Width, Viewport.Height);
            DrawSprite(textBottom, 0, new Vector2(textX, textY) - offset - textBottom.Middle, SpriteEffects.None, 0);
            FlushSpriteBatch();
            GraphicsDevice.ScissorRectangle = Viewport.Bounds;
            PopSpriteBatch();
        }
Ejemplo n.º 10
0
        private void DrawBackground()
        {
            float precision = 12;

            PushSpriteBatch(transform: Matrix.Identity);

            SpriteBatch.Draw(Pixel, new Rectangle(0, 0, Viewport.Width, Viewport.Height), Pixel.Bounds, new Color(77, 21, 13), 0, Vector2.Zero, SpriteEffects.None, 0f);

            for (int i = 0; i <= precision; i++)
            {
                var y     = (int)LerpHelper.QuadraticOut(Viewport.Height * 0.3f, Viewport.Height * 0.7f, i / precision);
                var color = Color.Lerp(new Color(77, 21, 13), new Color(238, 170, 45), i / precision);

                SpriteBatch.Draw(Pixel, new Rectangle(0, y, Viewport.Width, Viewport.Height), Pixel.Bounds, color, 0, Vector2.Zero, SpriteEffects.None, 0f);
            }

            var castle = SpriteLoader.Instance.AddSprite("content/title_castle");

            DrawSprite(castle, 0, new Vector2(0, 1000 - CastleHeight.Value - castle.Height), SpriteEffects.None, 0);

            PopSpriteBatch();
        }
Ejemplo n.º 11
0
        public override void Draw(Scene scene, Vector2 pos)
        {
            float width = (float)LerpHelper.QuarticOut(Width, 0, Frame.Slide);

            scene.SpriteBatch.Draw(scene.Pixel, pos, scene.Pixel.Bounds, Color, Angle, new Vector2(0.5f, 0.5f), new Vector2(width * 2, 10000), SpriteEffects.None, 0);
        }
Ejemplo n.º 12
0
        public IEnumerable <Wait> RoutineEndLevel()
        {
            var   tile        = PlayerCurio.GetMainTile();
            var   movable     = PlayerCurio.GetBehavior <BehaviorMovable>();
            var   orientation = PlayerCurio.GetBehavior <BehaviorOrientable>();
            var   end         = tile.GetBehavior <BehaviorLevelEnd>();
            var   player      = PlayerCurio.GetBehavior <BehaviorPlayer>();
            int   stains      = 0;
            float pitchSlide  = 0;

            foreach (var bloodStain in VisualEffects.OfType <BloodStain>())
            {
                RunStats.Splats += 1;
                stains          += 1;
                var center = PlayerCurio.GetVisualTarget();
                var emit   = bloodStain.WorldPosition;
                var delta  = Vector2.Normalize(emit - center);
                var offset = delta * Random.NextFloat(40, 80);
                int score;
                if (stains > 20)
                {
                    score = 1000;
                }
                else if (stains > 10)
                {
                    score = 500;
                }
                else
                {
                    score = 50;
                }
                pitchSlide = (float)LerpHelper.QuadraticIn(-1, 1, Math.Min(0, stains / 50f));

                var blob = new ScoreBlood(this, emit, center + delta * Random.NextFloat(4, 8), offset, Util.AngleToVector(Random.NextAngle()) * Random.NextFloat(80, 200), score, 20 + stains * 2);
                if (stains % 3 == 0)
                {
                    blob.Sound       = SoundBloodstainImpact.CreateInstance();
                    blob.Sound.Pitch = pitchSlide;
                }
                bloodStain.Destroy();
            }
            SoundBloodstain.Play(1, pitchSlide, 0);
            yield return(new WaitTime(30 + stains * 2));

            orientation.OrientTo(Util.PointToAngle(end.Direction), LerpHelper.QuadraticIn, new SliderScene(this, 10));
            player.Fade.Set(0, LerpHelper.QuadraticIn, 70);
            var pos = tile.VisualPosition;

            PlayerCurio.MoveVisual(GetOutsidePosition(pos, end.Direction, 200), LerpHelper.QuadraticIn, new SliderScene(this, 100));
            CameraCurio.MoveVisual(GetOutsidePosition(pos, end.Direction, 150), LerpHelper.QuadraticIn, new SliderScene(this, 100));
            SoundEgress.Play(1f, 0f, 0f);
            CurrentTheme.Volume.Set(0, LerpHelper.QuadraticIn, 90);
            player.LevelTransition = true;
            yield return(new WaitTime(100));

            CurrentTheme.Stop(false);
            PlayerCurio.MoveTo(null);
            CameraCurio.MoveTo(null);
            DestroyMap();
            Menu.SubMenu.Open(new BetweenLevelMenu(this));
            yield return(WaitForInput());

            GenerateMap();
            yield return(Scheduler.Instance.RunAndWait(RoutineStartLevel()));
        }