IEnumerator AnimateExplosion() { var explosionsLeft = animationParameters.explosionsCount.GetRandomValue(); while (explosionsLeft > 0) { OnExplode.Dispatch(); MakeSingleExplosion(); explosionsLeft--; yield return(new WaitForSecondsRealtime(animationParameters.delaysBetweenExplosions.GetRandomValue())); } }