public static void Draw(this SpriteBatch spriteBatch, ParticleEffect effect)
 {
     foreach (var emitter in effect.Emitters)
         Draw(spriteBatch, emitter);
 }
Beispiel #2
0
        private void ParticleInit(TextureRegion2D textureRegion)
        {
            _particleEffect = new ParticleEffect
            {
                Emitters = new[]
                {
                    new ParticleEmitter(500, TimeSpan.FromSeconds(2.5), Profile.Ring(150f, Profile.CircleRadiation.In))
                    {
                        TextureRegion = textureRegion,
                        Parameters = new ParticleReleaseParameters
                        {
                            Speed = new RangeF(50, 0f),
                            Quantity = 3,
                            Rotation = new RangeF(-1f, 1f),
                            Scale = new RangeF(3.0f, 4.0f)
                        },
                        Modifiers = new IModifier[]
                        {
                            new ColorInterpolator2 { InitialColor = new HslColor(0.33f, 0.5f, 0.5f), FinalColor = new HslColor(0.5f, 0.9f, 1.0f) },
                            new RotationModifier { RotationRate = -2.1f },
                            new RectangleContainerModifier {  Width = 800, Height = 480 },
                            new LinearGravityModifier { Direction = Axis.Up, Strength = 30f }
                        }
                    }
                }
            };

        }