/// <summary> /// Constructs a new projectile. /// </summary> public Projectile(ParticleSystem explosionParticles, ParticleSystem explosionSmokeParticles, ParticleSystem projectileTrailParticles, Vector3 pos, Vector3 vel, BBN_Game.Objects.StaticObject parent) { this.explosionParticles = explosionParticles; this.explosionSmokeParticles = explosionSmokeParticles; position = pos; velocity = vel; Parent = parent; //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); }
public ParticleController(Game g) { if (g is BBN_Game.BBNGame) { graphics = ((BBN_Game.BBNGame)g).Graphics; } spriteBatch = new SpriteBatch(g.GraphicsDevice); graphics.MinimumPixelShaderProfile = ShaderProfile.PS_2_0; //construct particle engine components explosionParticles = new ExplosionParticleSystem(g, g.Content,50,1,150,250); mediumMissileParticles = new ExplosionParticleSystem(g, g.Content, 40, 0.2, 20, 65); smallExplosionParticles = new ExplosionParticleSystem(g, g.Content,10,0.04,10,30); smallExplosionSmokeParticles = new ExplosionSmokeParticleSystem(g, g.Content,2,0.1,10,20); explosionSmokeParticles = new ExplosionSmokeParticleSystem(g, g.Content,200,1,100,200); projectileTrailParticles = new ProjectileTrailParticleSystem(g, g.Content); fireParticles = new FireParticleSystem(g, g.Content); //set draw order so explosions& fire will appear above smoke explosionSmokeParticles.DrawOrder = 100; smallExplosionSmokeParticles.DrawOrder = 120; projectileTrailParticles.DrawOrder = 200; explosionParticles.DrawOrder = 400; smallExplosionParticles.DrawOrder = 300; mediumMissileParticles.DrawOrder = 400; fireParticles.DrawOrder = 500; //register the particle system components g.Components.Add(explosionParticles); g.Components.Add(mediumMissileParticles); g.Components.Add(smallExplosionParticles); g.Components.Add(explosionSmokeParticles); g.Components.Add(smallExplosionSmokeParticles); g.Components.Add(projectileTrailParticles); g.Components.Add(fireParticles); }