This commit is contained in:
SzymonMis
2026-02-19 21:34:07 +01:00
parent 8de064552e
commit 06f9c7349d
25 changed files with 45269 additions and 346 deletions

View File

@@ -0,0 +1,30 @@
using System;
using UnityEngine;
namespace DemonBoss.AI
{
/// <summary>
/// Tiny helper MonoBehaviour to delay a callback without coroutines.
/// </summary>
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); }
}
}
}
}