I do believe I nailed this on my first try. Thanks to Sam with lectures and @Brian_Trotter for being my mental backstop here. This was INCREDIBLY satisfying to do to make a heal over time spell(which I also made an inflict self pain spell so I could see the heal working).
public class RepeatCompositeEffect : EffectStrategy
{
[Tooltip("Duration of Effect")]
[Min(0)][SerializeField] int duration = 10;
[Tooltip("Tick cycle time")]
[Min(0)][SerializeField] int tickTime = 1;
[Tooltip("List of effects to repeat.")]
[SerializeField] EffectStrategy[] delayedEffects;
public override void StartEffect(AbilityData data, Action finished)
{
data.StartCoroutine(RepeatEffect(data, finished));
}
private IEnumerator RepeatEffect(AbilityData data, Action finished)
{
for (int i = 0; i < duration; i += tickTime)
{
foreach (var effect in delayedEffects)
{
effect.StartEffect(data, finished);
}
yield return new WaitForSeconds(tickTime);
}
}
}
}
(it doesn’t like namespace and CreateAssetMenu up there)
[CreateAssetMenu(fileName = “Repeat Composite Effect”, menuName = “Abilities/Effects/Repeat Composite”, order = 0)]