/// <param name="p">the particle to initialize</param>
/// <param name="where">the position on the screen that the particle should be
/// </param>
protected virtual void InitializeParticle(Particle p, Vector2 where)
{
// first, call PickRandomDirection to figure out which way the particle
// will be moving. velocity and acceleration's values will come from this.
Vector2 direction = PickRandomDirection();
// pick some random values for our particle
float velocity =
Engine.RandomBetween(minInitialSpeed, maxInitialSpeed);
float acceleration =
Engine.RandomBetween(minAcceleration, maxAcceleration);
float lifetime =
Engine.RandomBetween(minLifetime, maxLifetime);
float scale =
Engine.RandomBetween(minScale, maxScale);
float rotationSpeed =
Engine.RandomBetween(minRotationSpeed, maxRotationSpeed);
// then initialize it with those random values. initialize will save those,
// and make sure it is marked as active.
p.Initialize(
where, velocity * direction, acceleration * direction,
lifetime, scale, rotationSpeed);
}