public void Update(GameTime gameTime) { // TODO: This could be more efficient if we knew upfront about all particle systems. foreach (var attachedParticleSystem in _scene.GetAllAttachedParticleSystems()) { var particleSystem = attachedParticleSystem.ParticleSystem; particleSystem.Update(gameTime); if (particleSystem.State == ParticleSystemState.Dead) { _deadParticleSystems.Add(attachedParticleSystem); } } foreach (var deadParticleSystem in _deadParticleSystems) { deadParticleSystem.Detach(); } _deadParticleSystems.Clear(); }