using System.Collections.Generic; namespace Konis.Testbed { /// /// The emitters one spawn of an started, and what it takes to end them together. /// public class RunningEffect { private readonly Emitter[] emitters; /// The emitter the effect is selected, moved and tuned by. /// Any others the effect runs, which are drawn under the primary. public RunningEffect(Emitter primary, params Emitter[] drawnBeneath) { emitters = new Emitter[drawnBeneath.Length + 1]; drawnBeneath.CopyTo(emitters, 0); emitters[drawnBeneath.Length] = primary; Primary = primary; } /// /// Gets the emitter the effect is selected, moved and tuned by. /// public Emitter Primary { get; } /// /// Gets every emitter the effect runs, in the order they are drawn, so the primary comes last and lies on top. /// public IReadOnlyList Emitters => emitters; /// /// Gets whether the effect has run its course. By default that is when its primary emitter has. /// public virtual bool IsFinished => Primary.IsFinished; /// /// Stops running every emitter of the effect, and takes their particles with them. /// public void Stop(ParticleWorld world) { foreach (Emitter emitter in emitters) { world.Remove(emitter); } } } }