Exemple #1
0
        private void EmitParticle()
        {
            if (i > TextureList.Count - 1) i = 0;

            Particle particle = new Particle(TextureList[i],
             Position,
             (float)emitterHelper.RandomizedDouble(ParticleSpeed),
             (float)emitterHelper.RandomizedDouble(ParticleDirection),
            MathHelper.ToRadians((float)emitterHelper.RandomizedDouble(ParticleRotation)),
            (float)emitterHelper.RandomizedDouble(RotationSpeed),
            Opacity);
            ParticleList.Add(particle);
            EmittedNewParticle = true;
            LastEmittedParticle = particle;
            i++;
        }
Exemple #2
0
        private void EmitParticle()
        {
            if (i > TextureList.Count - 1) i = 0;

            Particle particle;
            float speed = (float)emitterHelper.RandomizedDouble(ParticleSpeed);
            float direction = (float)emitterHelper.RandomizedDouble(ParticleDirection);
            float rotation = MathHelper.ToRadians((float)emitterHelper.RandomizedDouble(ParticleRotation));
            float rotationSpeed = (float)emitterHelper.RandomizedDouble(RotationSpeed);

            if (PooledParticles.Count > 0)
            {
                particle = PooledParticles.Dequeue();
                particle.Reuse(TextureList[i], Position, speed, direction, rotation, rotationSpeed, Opacity);
            }
            else
            {
                particle = new Particle(TextureList[i], Position, speed, direction, rotation, rotationSpeed, Opacity);
            }

            Particles.Add(particle);
            EmittedNewParticle = true;
            LastEmittedParticle = particle;
            i++;
        }