/// <summary> /// For internal use within the Spawn method of ParticleEffect and its subclasses /// Sets the particle's position, velocity, acceleration, and lifetime /// Velocity and acceleration are rotated by angle degrees /// Can pass in a subclass of Particle for more specific behavior /// </summary> /// <param name="particle">A Particle, or subclass thereof, to adjust the parameters of and add to the particle list</param> protected void AddNewParticle(Particle particle, float angle) { Matrix rotMatrix = Matrix.CreateRotationZ(MathHelper.ToRadians(angle)); //add randomness in positioning, movement, and life particle.Position = addRandomSpread(SourcePosition, PositionSpread); particle.Velocity = Vector2.Transform(addRandomSpread(BaseVelocity, VelocitySpread), rotMatrix); particle.Acceleration = Vector2.Transform(addRandomSpread(BaseAcceleration, AccelerationSpread), rotMatrix); particle.LifeTime = addRandomSpread(DefaultParticleLife, ParticleLifeSpread); mParticles.Add(particle); }
/// <summary> /// For internal use within the Spawn method of ParticleEffect and its subclasses /// Sets the particle's position, velocity, acceleration, and lifetime /// Can pass in a subclass of Particle for more specific behavior /// </summary> /// <param name="particle">A Particle, or subclass thereof, to adjust the parameters of and add to the particle list</param> protected void AddNewParticle(Particle particle) { //add randomness in positioning, movement, and life particle.Position = addRandomSpread(SourcePosition, PositionSpread); particle.Velocity = addRandomSpread(BaseVelocity, VelocitySpread); particle.Acceleration = addRandomSpread(BaseAcceleration, AccelerationSpread); particle.LifeTime = addRandomSpread(DefaultParticleLife, ParticleLifeSpread); mParticles.Add(particle); }