using System; using UnityEngine; namespace DemonBoss.AI { /// /// Tiny helper MonoBehaviour to delay a callback without coroutines. /// public sealed class DelayedInvoker : MonoBehaviour { private float _timeLeft; private Action _callback; public void Init(float delay, Action callback) { _timeLeft = delay; _callback = callback; } private void Update() { _timeLeft -= Time.deltaTime; if (_timeLeft <= 0f) { try { _callback?.Invoke(); } finally { Destroy(this); } } } } }