Example #1
0
        public override void DrawArcObject(SceneGame scene, DrawPass pass)
        {
            var spriteWraith      = SpriteLoader.Instance.AddSprite("content/wraith");
            var spriteWraithTrail = SpriteLoader.Instance.AddSprite("content/wraith_trail");
            var tile     = Curio.GetMainTile();
            var startPos = Source;
            var endPos   = tile.VisualTarget;

            Vector2 curve(float slide)
            {
                var a = Vector2.Lerp(startPos, startPos + VelocityStart, (float)LerpHelper.Quadratic(0, 1, slide));
                var b = Vector2.Lerp(endPos + VelocityEnd, endPos, (float)LerpHelper.Quadratic(0, 1, slide));

                return(Vector2.Lerp(a, b, (float)LerpHelper.Quadratic(0, 1, slide)));
            }

            Color colorStart = new Color(215, 63, 36);
            Color colorEnd   = new Color(118, 39, 102);

            if (pass == DrawPass.Effect)
            {
                int segments = 5;
                for (int i = 0; i < segments; i++)
                {
                    float   trailSlide = (float)i / (segments - 1);
                    float   trailPos   = (float)LerpHelper.QuadraticOut(Frame.Slide - 0.05f, Frame.Slide, trailSlide);
                    Vector2 pos        = curve(trailPos);
                    scene.DrawSpriteExt(spriteWraithTrail, 0, pos - spriteWraithTrail.Middle, spriteWraithTrail.Middle, 0, Vector2.One, SpriteEffects.None, Color.Lerp(colorStart.WithAlpha(0), colorEnd, trailSlide), 0);
                }
            }
            if (pass == DrawPass.EffectAdditive)
            {
                scene.DrawSpriteExt(spriteWraith, 0, curve(Frame.Slide) - spriteWraith.Middle, spriteWraith.Middle, 0, Vector2.One, SpriteEffects.None, colorStart, 0);
            }
        }
Example #2
0
        private void DrawWing(SceneGame scene, SpriteReference sprite, Color color, int segments, float directionMod, float distanceMod, Microsoft.Xna.Framework.Graphics.SpriteEffects mirror)
        {
            //new Color(244, 211, 23)
            //SpriteReference hand = SpriteLoader.Instance.AddSprite("content/hand");
            int index = 0;

            for (int i = 1; i <= segments; i++)
            {
                int     subSegments = 9;
                float   angle       = directionMod * MathHelper.ToRadians(90 - i * 5);
                float   distance    = (float)LerpHelper.Quadratic(10, distanceMod * 50, (float)i / segments);
                Vector2 pivot       = VisualPosition() + Util.AngleToVector(angle) * distance;
                scene.DrawSpriteExt(sprite, 0, pivot + GetHandOffset(index), sprite.Middle, angle + directionMod * MathHelper.PiOver4, Vector2.One, mirror, color, 0);
                index++;
                for (int e = 0; e <= subSegments; e++)
                {
                    float subSegmentSlide = (float)e / (subSegments + 1);
                    float subAngle        = angle - directionMod * MathHelper.ToRadians(i * 2);
                    float subDistance     = distanceMod * e * 5;
                    float visAngle        = subAngle + directionMod * MathHelper.PiOver2 + directionMod * MathHelper.ToRadians(i * -10);
                    scene.DrawSpriteExt(sprite, 0, pivot + GetHandOffset(index) + Util.AngleToVector(subAngle) * subDistance, sprite.Middle, visAngle, Vector2.One, mirror, color * MathHelper.Lerp(0.3f, 1, subSegmentSlide), 0);
                    index++;
                }
            }
        }
Example #3
0
        private static IEnumerable <Vector2> GetWingPositions(Vector2 position, int segments, float directionMod, float distanceMod)
        {
            int index = 0;

            for (int i = 1; i <= segments; i++)
            {
                int     subSegments = 9;
                float   angle       = directionMod * MathHelper.ToRadians(90 - i * 5);
                float   distance    = (float)LerpHelper.Quadratic(10, distanceMod * 50, (float)i / segments);
                Vector2 pivot       = position + Util.AngleToVector(angle) * distance;
                yield return(pivot);

                index++;
                for (int e = 0; e <= subSegments; e++)
                {
                    float subAngle    = angle - directionMod * MathHelper.ToRadians(i * 2);
                    float subDistance = distanceMod * e * 5;
                    yield return(pivot + Util.AngleToVector(subAngle) * subDistance);

                    index++;
                }
            }
        }