示例#1
0
        public ParticlesManager(WarZGame game)
            : base(game)
        {
            WZGame = game;

            explosionParticles = new ExplosionParticleSystem(WZGame);
            explosionSmokeParticles = new ExplosionSmokeParticleSystem(WZGame);
            projectileTrailParticles = new ProjectileTrailParticleSystem(WZGame);
            smokePlumeParticles = new SmokePlumeParticleSystem(WZGame);
            fireParticles = new FireParticleSystem(WZGame);

            // Set the draw order so the explosions and fire
            // will appear over the top of the smoke.
            smokePlumeParticles.DrawOrder = 150;
            explosionSmokeParticles.DrawOrder = 200;
            projectileTrailParticles.DrawOrder = 300;
            explosionParticles.DrawOrder = 400;
            fireParticles.DrawOrder = 500;

            // Register the particle system WZGame.Components.
            WZGame.Components.Add(explosionParticles);
            WZGame.Components.Add(explosionSmokeParticles);
            WZGame.Components.Add(projectileTrailParticles);
            WZGame.Components.Add(smokePlumeParticles);
            WZGame.Components.Add(fireParticles);
        }
示例#2
0
        /// <summary>
        /// Constructs a new particle emitter object.
        /// </summary>
        public ParticleEmitter(ParticleSystem particleSystem,
                               float particlesPerSecond, Vector3 initialPosition)
        {
            this.particleSystem = particleSystem;

            timeBetweenParticles = 1.0f / particlesPerSecond;

            previousPosition = initialPosition;
        }
示例#3
0
        public Explosion(ParticleSystem explosionParticles,
                          ParticleSystem explosionSmokeParticles)
        {
            this.explosionParticles = explosionParticles;
            this.explosionSmokeParticles = explosionSmokeParticles;

            // Start at the origin, firing in a random (but roughly upward) direction.
            //Position = Vector3.Zero;

            velocity.X = (float)(random.NextDouble() - 0.5) * sidewaysVelocityRange;
            velocity.Y = (float)(random.NextDouble() + 0.5) * verticalVelocityRange;
            velocity.Z = (float)(random.NextDouble() - 0.5) * sidewaysVelocityRange;
        }
示例#4
0
        /// <summary>
        /// Constructs a new projectile.
        /// </summary>
        public Projectile(ParticleSystem explosionParticles,
                          ParticleSystem explosionSmokeParticles,
                          ParticleSystem projectileTrailParticles)
        {
            this.explosionParticles = explosionParticles;
            this.explosionSmokeParticles = explosionSmokeParticles;

            // Start at the origin, firing in a random (but roughly upward) direction.
            //Position = Vector3.Zero;

            velocity.X = (float)(random.NextDouble() - 0.5) * sidewaysVelocityRange;
            velocity.Y = (float)(random.NextDouble() + 0.5) * verticalVelocityRange;
            velocity.Z = (float)(random.NextDouble() - 0.5) * sidewaysVelocityRange;

            // Use the particle emitter helper to output our trail particles.
            trailEmitter = new ParticleEmitter(projectileTrailParticles,
                                               trailParticlesPerSecond, Position);
        }