예제 #1
0
        public RocketTrails(Game game, ContentManager Content)
        {
            givenGame = game;

            explosionParticles = new Beasty.ParticleSystems.ExplosionParticleSystem(game, Content);
            explosionSmokeParticles = new Beasty.ParticleSystems.ExplosionSmokeParticleSystem(game, Content);
            projectileTrailParticles = new Beasty.ParticleSystems.ProjectileTrailParticleSystem(game, Content);
            //smokePlumeParticles = new Beasty.ParticleSystems.SmokePlumeParticleSystem(game, Content);
            //fireParticles = new Beasty.ParticleSystems.FireParticleSystem(game, Content);

            // Set the draw order so the explosions and fire
            // will appear over the top of the smoke.
            smokePlumeParticles.DrawOrder = 10;
            explosionSmokeParticles.DrawOrder = 20;
            projectileTrailParticles.DrawOrder = 30;
            explosionParticles.DrawOrder = 40;
            fireParticles.DrawOrder = 50;

            // Register the particle system components.
            game.Components.Add(explosionParticles);
            game.Components.Add(explosionSmokeParticles);
            game.Components.Add(projectileTrailParticles);
            game.Components.Add(smokePlumeParticles);
            game.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
        /// <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);
        }