mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-10 12:39:53 +00:00
remove RepeatingManager
This commit is contained in:
parent
146b027569
commit
828caa9630
@ -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>();
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user