/// <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; }
/// <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); }
public bool TryGetValue(string name, out ParticleSystem value) { return particleList.TryGetValue(name, out value); }
public void Add(ParticleSystem particle) { if (particleList.ContainsKey(particle.Name)) throw new Exception("Key collision"); particleList.Add(particle.Name, particle); }