コード例 #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);
        }
コード例 #2
0
ファイル: SkillUtil.cs プロジェクト: DaedalusGame/7DRL_2021
        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);
        }
コード例 #3
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);
        }
コード例 #4
0
ファイル: SceneTitle.cs プロジェクト: DaedalusGame/7DRL_2021
        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();
        }