/// <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; }
public void Initialize() { explosionParticles = new ExplosionParticleSystem(game, game.Content); explosionSmokeParticles = new ExplosionSmokeParticleSystem(game, game.Content); trailParticles = new ProjectileTrailParticleSystem(game, game.Content); explosionParticles.Settings = CreateSettingsForExplosion(); explosionSmokeParticles.Settings = CreateSettingsForExplosionSmoke(); trailParticles.Settings = CreateSettingsForTrail(); explosionSmokeParticles.DrawOrder = 200; trailParticles.DrawOrder = 300; explosionParticles.DrawOrder = 400; game.Components.Add(explosionParticles); game.Components.Add(explosionSmokeParticles); game.Components.Add(trailParticles); trailEmitter = new ParticleEmitter(trailParticles, trailParticlesPerSecond, Vector3.Zero); }
/// <summary> /// Constructor of FireRing Class. /// </summary> public MyRing(Game game, float objectScale) { owner = game; random = new Random(); scale = objectScale; // Construct our particle system components. fireParticles = new FireParticleSystem(game, game.Content); smokePlumeParticles = new SmokePlumeParticleSystem(game, game.Content); // Scale particle by current radius / 30.0f (default radius). fireParticles.Settings = CreateSettingsForFire(); smokePlumeParticles.Settings = CreateSettingsForSmokePlume(); // Set the draw order so the explosions and fire // will appear over the top of the smoke. smokePlumeParticles.DrawOrder = 100; fireParticles.DrawOrder = 200; // Register the particle system components. game.Components.Add(smokePlumeParticles); game.Components.Add(fireParticles); }