コード例 #1
0
ファイル: ParticlesManager.cs プロジェクト: vvolkgang/WarZ
        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
ファイル: ParticleEmitter.cs プロジェクト: vvolkgang/WarZ
        /// <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
ファイル: Explosion.cs プロジェクト: vvolkgang/WarZ
        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
ファイル: Projectile.cs プロジェクト: vvolkgang/WarZ
        /// <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);
        }