mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-06 01:00:16 +00:00
only update transform from host after receiving the transform, instead of every frame
This commit is contained in:
parent
9892ebe07f
commit
8ce1f706f8
@ -1,9 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using QSB.MeteorSync.WorldObjects;
|
||||
using QSB.Syncs.Unsectored.Rigidbodies;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using UnityEngine;
|
||||
using QuantumUNET.Transport;
|
||||
|
||||
namespace QSB.MeteorSync.TransformSync
|
||||
{
|
||||
@ -40,18 +39,30 @@ namespace QSB.MeteorSync.TransformSync
|
||||
|
||||
base.Init();
|
||||
SetReferenceTransform(Locator._brittleHollow.transform);
|
||||
}
|
||||
|
||||
DebugLog.DebugWrite($"{LogName} - init");
|
||||
|
||||
private bool _shouldUpdate;
|
||||
|
||||
public override void DeserializeTransform(QNetworkReader reader, bool initialState)
|
||||
{
|
||||
base.DeserializeTransform(reader, initialState);
|
||||
_shouldUpdate = true;
|
||||
}
|
||||
|
||||
protected override bool UpdateTransform()
|
||||
{
|
||||
// DebugLog.DebugWrite($"{LogName} - {Time.time - _lastClientSendTime}");
|
||||
if (Time.time - _lastClientSendTime > GetNetworkSendInterval())
|
||||
if (HasAuthority)
|
||||
{
|
||||
return base.UpdateTransform();
|
||||
}
|
||||
return false;
|
||||
|
||||
if (!_shouldUpdate)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_shouldUpdate = false;
|
||||
return base.UpdateTransform();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user