public void Update(float frameTime) { foreach (var emitter in Emitters) { emitter.Update(frameTime); } foreach (var particleOperator in Operators) { particleOperator.Update(particles, frameTime); } // Remove all dead particles particles = particles.Where(p => p.Lifetime > 0).ToList(); foreach (var childParticleRenderer in childParticleRenderers) { childParticleRenderer.Update(frameTime); } // Restart if all emitters are done and all particles expired if (Emitters.All(e => e.IsFinished) && particles.Count == 0) { Restart(); } }
public bool IsFinished() => Emitters.All(e => e.IsFinished) && particles.Count == 0 && childParticleRenderers.All(r => r.IsFinished());