using Azimuth;
namespace Konis.Testbed
{
///
/// An effect the testbed started, with what it takes to start it again.
///
public class SpawnedEffect
{
public SpawnedEffect(RunningEffect running, int effectIndex, Vector3 position)
{
Running = running;
EffectIndex = effectIndex;
Position = position;
}
public SpawnedEffect(Emitter emitter, int effectIndex, Vector3 position)
: this(new RunningEffect(emitter), effectIndex, position)
{
}
///
/// The emitters now running the effect.
///
public RunningEffect Running { get; set; }
///
/// Gets the emitter the effect is selected, moved and tuned by.
///
public Emitter Emitter => Running.Primary;
///
/// Which of the effect is.
///
public int EffectIndex { get; }
///
/// Where the effect was spawned.
///
public Vector3 Position { get; }
///
/// Gets a running average of the stopwatch ticks a frame spent writing the effect's particles out as sprites.
///
public double AverageWriteTicks { get; private set; }
///
/// Takes how many stopwatch ticks writing the particles out took this frame.
///
public void RecordWriteCost(long ticks)
{
AverageWriteTicks += (ticks - AverageWriteTicks) * Emitter.UpdateCostSmoothing;
}
}
}