remove RepeatingManager

This commit is contained in:
JohnCorby 2021-12-18 12:25:16 -08:00
parent 146b027569
commit 828caa9630
3 changed files with 20 additions and 33 deletions

View File

@ -117,7 +117,6 @@ namespace QSB
gameObject.AddComponent<ConversationManager>();
gameObject.AddComponent<QSBInputManager>();
gameObject.AddComponent<TimeSyncUI>();
gameObject.AddComponent<RepeatingManager>();
gameObject.AddComponent<PlayerEntanglementWatcher>();
gameObject.AddComponent<DebugGUI>();
gameObject.AddComponent<MenuManager>();

View File

@ -15,11 +15,28 @@ namespace QSB.SectorSync
public bool IsReady { get; private set; }
public List<QSBSector> FakeSectors = new();
private void OnEnable() => RepeatingManager.Repeatings.Add(this);
private void OnDisable() => RepeatingManager.Repeatings.Remove(this);
public List<BaseSectoredSync> SectoredSyncs = new();
#region repeating timer
private const float TimeInterval = 0.4f;
private float _checkTimer = TimeInterval;
private void Update()
{
_checkTimer += Time.unscaledDeltaTime;
if (_checkTimer < TimeInterval)
{
return;
}
Invoke();
_checkTimer = 0;
}
#endregion
public void Invoke()
{
if (!Instance.IsReady || !AllObjectsReady)

View File

@ -1,29 +0,0 @@
using System.Collections.Generic;
using UnityEngine;
namespace QSB.Utility
{
internal class RepeatingManager : MonoBehaviour
{
public static List<IRepeating> Repeatings = new();
private const float TimeInterval = 0.4f;
private float _checkTimer = TimeInterval;
private void Update()
{
_checkTimer += Time.unscaledDeltaTime;
if (_checkTimer < TimeInterval)
{
return;
}
foreach (var repeat in Repeatings)
{
repeat.Invoke();
}
_checkTimer = 0;
}
}
}