2021-02-19 10:09:14 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace QSB.Utility
|
|
|
|
|
{
|
2021-02-19 10:14:03 +00:00
|
|
|
|
internal class RepeatingManager : MonoBehaviour
|
2021-02-19 10:09:14 +00:00
|
|
|
|
{
|
|
|
|
|
public static List<IRepeating> Repeatings = new List<IRepeating>();
|
|
|
|
|
|
2021-02-19 12:42:37 +00:00
|
|
|
|
private const float TimeInterval = 0.4f;
|
2021-02-19 10:09:14 +00:00
|
|
|
|
private float _checkTimer = TimeInterval;
|
|
|
|
|
|
2021-02-19 10:14:03 +00:00
|
|
|
|
private void Update()
|
2021-02-19 10:09:14 +00:00
|
|
|
|
{
|
|
|
|
|
_checkTimer += Time.unscaledDeltaTime;
|
|
|
|
|
if (_checkTimer < TimeInterval)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
foreach (var repeat in Repeatings)
|
|
|
|
|
{
|
|
|
|
|
repeat.Invoke();
|
|
|
|
|
}
|
|
|
|
|
_checkTimer = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|