示例#1
0
        public override void Activate(Creature creature)
        {
            var cloak = new Cloak(creature, 10);

            cloak.OnUpdate += (c) =>
            {
                float size = 0.15f + 0.15f * Random.NextFloat();
                size *= (float)LerpHelper.CircularOut(1, 0.5, c.Frame.GetSubSlide(10, c.Frame.EndTime));

                if (c.Frame.Time % 2 == 0)
                {
                    var   pos       = c.Creature.VisualTarget;
                    int   totaltime = 5 + Random.Next(10);
                    float bigSize   = 1.5f + Random.NextFloat();
                    Color color     = Color.Lerp(Color.White, Color.Gray, Random.NextFloat());

                    new ParticleCutter(World, totaltime + Random.Next(4))
                    {
                        Sprite        = SpriteLoader.Instance.AddSprite("content/cutter"),
                        FadeSlide     = 0.75f,
                        Position      = pos,
                        Angle         = Random.NextAngle(),
                        RotationStart = -MathHelper.TwoPi / totaltime,
                        RotationEnd   = -(MathHelper.TwoPi / totaltime) * 0.5f,
                        AngleLerp     = LerpHelper.Linear,
                        Scale         = size,
                        ScaleEnd      = size * bigSize,
                        ScaleLerp     = LerpHelper.CircularOut,
                        Color         = color,
                        Pass          = DrawPass.EffectAdditive,
                    };
                }
            };
        }
示例#2
0
        public override void Activate(Creature creature)
        {
            var fire_small = SpriteLoader.Instance.AddSprite("content/fire_small");

            var cloak = new Cloak(creature, 10);

            cloak.OnUpdate += (c) =>
            {
                float size = 0.15f + 0.15f * Random.NextFloat();
                size *= (float)LerpHelper.CircularOut(1, 0.5, c.Frame.GetSubSlide(10, c.Frame.EndTime));

                if (c.Frame.Time % 1 == 0)
                {
                    var   pos       = c.Creature.VisualTarget;
                    int   totaltime = 5 + Random.Next(10);
                    float bigSize   = 1.5f + Random.NextFloat();
                    Color color     = new Color(255, 64, 16);

                    new ParticleCutter(World, totaltime + Random.Next(4))
                    {
                        Sprite        = SpriteLoader.Instance.AddSprite("content/cutter"),
                        FadeSlide     = 0.75f,
                        Position      = pos,
                        Angle         = Random.NextAngle(),
                        RotationStart = -MathHelper.TwoPi / totaltime,
                        RotationEnd   = -(MathHelper.TwoPi / totaltime) * 0.5f,
                        AngleLerp     = LerpHelper.Linear,
                        Scale         = size,
                        ScaleEnd      = size * bigSize,
                        ScaleLerp     = LerpHelper.CircularOut,
                        Color         = color,
                        Pass          = DrawPass.EffectAdditive,
                    };
                }
            };

            for (int i = 0; i < 3; i++)
            {
                float angle         = Random.NextFloat() * MathHelper.TwoPi;
                float distance      = 12 + Random.NextFloat() * 12;
                int   time          = Random.Next(10) + 20;
                var   waterParticle = new ParticleThrow(World, null, creature.VisualTarget, creature.VisualTarget + Util.AngleToVector(angle) * distance, 16 + Random.NextFloat() * 8, LerpHelper.Linear, LerpHelper.QuadraticOut, time, 0.7f)
                {
                    Scale = Random.NextFloat() * 0.75f + 0.25f,
                    Pass  = DrawPass.EffectAdditive,
                };
                waterParticle.OnUpdate += (particle) =>
                {
                    if (particle.Frame.Time % 4 == i % 4)
                    {
                        var explosion = new ParticleExplosion(World, fire_small, Vector2.Zero, LerpHelper.Linear, LerpHelper.Linear, 10)
                        {
                            Position = particle.Position,
                        };
                    }
                };
            }
        }
示例#3
0
        public override void Activate(Creature creature)
        {
            var particle = SpriteLoader.Instance.AddSprite("content/rock");

            var cloak = new Cloak(creature, 10);

            cloak.OnUpdate += (c) =>
            {
                float size = 0.15f + 0.15f * Random.NextFloat();
                size *= (float)LerpHelper.CircularOut(1, 0.5, c.Frame.GetSubSlide(10, c.Frame.EndTime));

                if (c.Frame.Time % 1 == 0)
                {
                    var   pos       = c.Creature.VisualTarget;
                    int   totaltime = 5 + Random.Next(10);
                    float bigSize   = 1.5f + Random.NextFloat();
                    Color color     = new Color(64, 128, 255);

                    new ParticleCutter(World, totaltime + Random.Next(4))
                    {
                        Sprite        = SpriteLoader.Instance.AddSprite("content/cutter"),
                        FadeSlide     = 0.75f,
                        Position      = pos,
                        Angle         = Random.NextAngle(),
                        RotationStart = -MathHelper.TwoPi / totaltime,
                        RotationEnd   = -(MathHelper.TwoPi / totaltime) * 0.5f,
                        AngleLerp     = LerpHelper.Linear,
                        Scale         = size,
                        ScaleEnd      = size * bigSize,
                        ScaleLerp     = LerpHelper.CircularOut,
                        Color         = color,
                        Pass          = DrawPass.EffectAdditive,
                    };
                }

                if (c.Frame.Time % 2 == 0)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        float angle       = Random.NextFloat() * MathHelper.TwoPi;
                        float distance    = 12 + Random.NextFloat() * 12;
                        int   time        = Random.Next(10) + 10;
                        var   iceParticle = new ParticleThrow(World, particle, creature.VisualTarget + Util.AngleToVector(angle) * 4, creature.VisualTarget + Util.AngleToVector(angle) * distance, 4 + Random.NextFloat() * 8, LerpHelper.Linear, LerpHelper.QuadraticOut, time, 0.7f)
                        {
                            SubImage    = Random.Next(particle.SubImageCount),
                            Angle       = Random.NextAngle(),
                            ColorMatrix = ColorMatrix.TwoColorLight(Color.Blue, Color.White),
                            Pass        = DrawPass.EffectAdditive,
                        };
                    }
                }
            };
        }
示例#4
0
 public static void PowerDown(Cloak cloak, int modulo, ColorMatrix color, LerpHelper.Delegate scaleLerp, LerpHelper.Delegate colorLerp, int time)
 {
     if (cloak.Frame.Time % modulo == 0)
     {
         var afterimage = new ParticleAfterImageLocked(cloak.Creature, scaleLerp, colorLerp, time)
         {
             Position    = cloak.Creature.VisualPosition(),
             ColorMatrix = color,
             Scale       = 1f,
             ScaleEnd    = 2f,
             Pass        = DrawPass.Effect,
             Origin      = cloak.Creature.TopOffset,
         };
     }
 }