Exemplo n.º 1
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,
                        };
                    }
                };
            }
        }
Exemplo n.º 2
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,
                        };
                    }
                }
            };
        }
Exemplo n.º 3
0
        public override void Activate(Creature creature)
        {
            var particle = SpriteLoader.Instance.AddSprite("content/rock");

            for (int i = 0; i < 16; i++)
            {
                float angle         = Random.NextFloat() * MathHelper.TwoPi;
                float distance      = 4 + Random.NextFloat() * 12;
                int   time          = Random.Next(10) + 10;
                var   earthParticle = new ParticleThrow(World, particle, creature.VisualTarget + Util.AngleToVector(angle) * 2, 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(),
                    Color    = new Color(162, 137, 119),
                };
            }
        }
Exemplo n.º 4
0
        public override void Activate(Creature creature)
        {
            var particle = SpriteLoader.Instance.AddSprite("content/rock");

            for (int i = 0; i < 12; i++)
            {
                float angle       = Random.NextFloat() * MathHelper.TwoPi;
                float distance    = 4 + Random.NextFloat() * 12;
                int   time        = Random.Next(10) + 10;
                var   iceParticle = new ParticleThrow(World, particle, creature.VisualTarget + Util.AngleToVector(angle) * 2, 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,
                };
            }
            creature.FlashHelper.AddFlash(ColorMatrix.Flat(Color.White), LerpHelper.QuadraticOut, 5);
            creature.FlashHelper.AddFlash(ColorMatrix.TwoColorLight(Color.SkyBlue, Color.White), 10);
        }
Exemplo n.º 5
0
        public override void Activate(Creature creature)
        {
            var blob_acid = SpriteLoader.Instance.AddSprite("content/pop_acid");
            var particle  = SpriteLoader.Instance.AddSprite("content/bullet_acid");

            var explosion = new ParticleExplosion(World, blob_acid, Vector2.Zero, LerpHelper.Linear, LerpHelper.Linear, 10)
            {
                Position = creature.VisualTarget,
            };

            for (int i = 0; i < 6; i++)
            {
                float angle        = Random.NextFloat() * MathHelper.TwoPi;
                float distance     = 4 + Random.NextFloat() * 12;
                int   time         = Random.Next(10) + 10;
                var   acidParticle = new ParticleThrow(World, particle, creature.VisualTarget, creature.VisualTarget + Util.AngleToVector(angle) * distance, 4 + Random.NextFloat() * 8, LerpHelper.Linear, LerpHelper.QuadraticOut, time, 0.7f)
                {
                    Scale = Random.NextFloat() * 0.75f + 0.25f,
                };
            }
        }
Exemplo n.º 6
0
        public override void Activate(Creature creature)
        {
            var blob_water     = SpriteLoader.Instance.AddSprite("content/pop_blob_water");
            var particle_water = SpriteLoader.Instance.AddSprite("content/bullet_water");
            var particle_ice   = SpriteLoader.Instance.AddSprite("content/rock");

            var explosion = new ParticleExplosion(World, blob_water, Vector2.Zero, LerpHelper.Linear, LerpHelper.Linear, 10)
            {
                Position = creature.VisualTarget,
                Pass     = DrawPass.EffectAdditive,
            };

            for (int i = 0; i < 6; i++)
            {
                float angle         = Random.NextFloat() * MathHelper.TwoPi;
                float distance      = 4 + Random.NextFloat() * 12;
                int   time          = Random.Next(10) + 10;
                var   waterParticle = new ParticleThrow(World, particle_water, creature.VisualTarget, creature.VisualTarget + Util.AngleToVector(angle) * distance, 4 + Random.NextFloat() * 8, LerpHelper.Linear, LerpHelper.QuadraticOut, time, 0.7f)
                {
                    Scale = Random.NextFloat() * 0.75f + 0.25f,
                    Pass  = DrawPass.EffectAdditive,
                };
            }

            for (int i = 0; i < 12; i++)
            {
                float angle       = Random.NextFloat() * MathHelper.TwoPi;
                float distance    = 4 + Random.NextFloat() * 12;
                int   time        = Random.Next(10) + 10;
                var   iceParticle = new ParticleThrow(World, particle_ice, creature.VisualTarget + Util.AngleToVector(angle) * 2, creature.VisualTarget + Util.AngleToVector(angle) * distance, 4 + Random.NextFloat() * 8, LerpHelper.Linear, LerpHelper.QuadraticOut, time, 0.7f)
                {
                    SubImage    = Random.Next(particle_ice.SubImageCount),
                    Angle       = Random.NextAngle(),
                    ColorMatrix = ColorMatrix.TwoColorLight(Color.Blue, Color.White),
                    Pass        = DrawPass.EffectAdditive,
                };
            }
        }
Exemplo n.º 7
0
        public override void Activate(Creature creature)
        {
            var sparkle          = SpriteLoader.Instance.AddSprite("content/sparkle_item");
            var particle_sparkle = SpriteLoader.Instance.AddSprite("content/sparkle");

            var explosion = new ParticleExplosion(World, sparkle, Vector2.Zero, LerpHelper.Linear, LerpHelper.Linear, 20)
            {
                Position = creature.VisualTarget,
                Pass     = DrawPass.EffectAdditive,
            };
            int   sparkles = 4;
            float fan      = MathHelper.Pi * 0.4f;

            for (int i = 0; i < sparkles; i++)
            {
                float angle        = -fan + i * fan * 2f / (sparkles - 1);
                var   holyParticle = new ParticleThrow(World, particle_sparkle, creature.VisualTarget, creature.VisualTarget + Util.AngleToVector(angle) * 16, 4, LerpHelper.QuadraticOut, LerpHelper.QuadraticOut, 15, 0.7f)
                {
                    SubImage   = Random.Next(particle_sparkle.SubImageCount),
                    ImageSpeed = 0.5f,
                    Pass       = DrawPass.EffectAdditive,
                };
            }
        }