Ejemplo n.º 1
0
 public void Add(Particle particle)
 {
     int particleIndex = ParticleCount++;
     if (particleIndex >= particles.Length)
     {
         Debug.Warning("Perf Warning: Had to resize particle system: {0} (Ran out of free slots)", GetType().Name);
         Array.Resize(ref particles, particles.Length * 2);
     }
     particles[particleIndex] = particle;
 }
Ejemplo n.º 2
0
        public override void UpdateAndDraw(Particle particle, float deltaTime, IRenderTarget target)
        {
            particle.Speed += new Vector2(0f, 300f) * deltaTime;
            particle.Color = initialColor.Transition(endColor, particle.Age / particle.Life);
            var backColor = new Color(0, 0, 0, 255).Transition(new Color(0, 0, 0, 0), particle.Age / particle.Life);
            particle.Coordinate += particle.Speed * deltaTime;

            target.DrawTexture(Texture, particle.Coordinate - new Vector2(2f, 2f), backColor, particle.Scale + new Vector2(4f, 4f), Origin, particle.Rotation.Degree, new Rectangle(Vector2.Zero, Texture.Size));
            target.DrawTexture(Texture, particle.Coordinate, particle.Color, particle.Scale, Origin, particle.Rotation.Degree, new Rectangle(Vector2.Zero, Texture.Size));
        }
Ejemplo n.º 3
0
 public abstract void UpdateAndDraw(Particle particle, float deltaTime, IRenderTarget target);