update sectorsync to use irepeating

This commit is contained in:
Mister_Nebula 2021-02-19 12:42:37 +00:00
parent 183e149edd
commit d739be6f95
3 changed files with 8 additions and 16 deletions

View File

@ -107,7 +107,7 @@ namespace QSB
GUI.Label(new Rect(220, 10, 200f, 20f), $"FPS : {Mathf.Round(1f / Time.smoothDeltaTime)}");
GUI.Label(new Rect(220, 40, 200f, 20f), $"HasWokenUp : {HasWokenUp}");
if (!QSBCore.HasWokenUp || !QSBCore.DebugMode)
if (!HasWokenUp || !DebugMode)
{
return;
}
@ -124,8 +124,8 @@ namespace QSB
offset += 30f;
GUI.Label(new Rect(220, offset, 200f, 20f), $"QM Illuminated : {Locator.GetQuantumMoon().IsIlluminated()}");
offset += 30f;
//GUI.Label(new Rect(220, offset, 200f, 20f), $"Shrine player in dark? : {QuantumManager.Instance.Shrine.IsPlayerInDarkness()}");
//offset += 30f;
GUI.Label(new Rect(220, offset, 200f, 20f), $"Shrine player in dark? : {QuantumManager.Instance.Shrine.IsPlayerInDarkness()}");
offset += 30f;
var tracker = Locator.GetQuantumMoon().GetValue<ShapeVisibilityTracker>("_visibilityTracker");
foreach (var camera in QSBPlayerManager.GetPlayerCameras())
{
@ -133,7 +133,7 @@ namespace QSB
offset += 30f;
}
// Used for diagnosing specific socketed objects. Just set <index> to be the correct index.
// Used for diagnosing specific socketed objects. Set <index> to be the correct index.
/*
var index = 110;
var socketedObject = QSBWorldSync.GetWorldObject<QSBSocketedQuantumObject>(index);

View File

@ -1,30 +1,22 @@
using QSB.Events;
using QSB.Player;
using QSB.SectorSync.WorldObjects;
using QSB.Utility;
using System.Linq;
using UnityEngine;
namespace QSB.SectorSync
{
public class SectorSync : MonoBehaviour
public class SectorSync : MonoBehaviour, IRepeating
{
private const float CheckInterval = 0.5f;
private float _checkTimer = CheckInterval;
public void Update()
public void Invoke()
{
if (!QSBSectorManager.Instance.IsReady)
{
return;
}
_checkTimer += Time.unscaledDeltaTime;
if (_checkTimer < CheckInterval)
{
return;
}
QSBPlayerManager.GetSyncObjects<TransformSync.TransformSync>()
.Where(x => x.HasAuthority).ToList().ForEach(CheckTransformSyncSector);
_checkTimer = 0;
}
private void CheckTransformSyncSector(TransformSync.TransformSync transformSync)

View File

@ -7,7 +7,7 @@ namespace QSB.Utility
{
public static List<IRepeating> Repeatings = new List<IRepeating>();
private const float TimeInterval = 0.2f;
private const float TimeInterval = 0.4f;
private float _checkTimer = TimeInterval;
private void Update()