Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 3
0
 protected override void InitializeParticle(Particle p, Vector2 where,Vector2 direction)
 {
     base.InitializeParticle(p, where, direction);
     p.Acceleration = new Vector2(0, 0);
 }