protected override void InitializeParticle(Particle p, Vector2 where,Vector2 direction)
        {
            direction = PickRandomDirection();

            // pick some random values for our particle
            float velocity =
                RandomNumberProvider.RandomBetween(minInitialSpeed, maxInitialSpeed);
            float acceleration =
                RandomNumberProvider.RandomBetween(minAcceleration, maxAcceleration);
            float lifetime =
                RandomNumberProvider.RandomBetween(minLifetime, maxLifetime);
            float scale =
                RandomNumberProvider.RandomBetween(minScale, maxScale);
            float rotationSpeed =
                RandomNumberProvider.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);
        }
Example #2
0
        public override void Initialize()
        {
            InitializeConstants();

            // calculate the total number of particles we will ever need, using the
            // max number of effects and the max number of particles per effect.
            particles = new Particle[howManyEffects * maxNumParticles];
            freeParticles = new Queue<Particle>(howManyEffects * maxNumParticles);
            for (int i = 0; i < particles.Length; i++)
            {
                particles[i] = new Particle();
                freeParticles.Enqueue(particles[i]);
            }
            base.Initialize();
        }
 protected override void InitializeParticle(Particle p, Vector2 where,Vector2 direction)
 {
     base.InitializeParticle(p, where, direction);
     p.Acceleration = new Vector2(0, 0);
 }