mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-27 03:35:20 +00:00
only update transform from host after receiving the transform, instead of every frame
This commit is contained in:
parent
9892ebe07f
commit
157cc185da
@ -3,7 +3,7 @@ using QSB.MeteorSync.WorldObjects;
|
|||||||
using QSB.Syncs.Unsectored.Rigidbodies;
|
using QSB.Syncs.Unsectored.Rigidbodies;
|
||||||
using QSB.Utility;
|
using QSB.Utility;
|
||||||
using QSB.WorldSync;
|
using QSB.WorldSync;
|
||||||
using UnityEngine;
|
using QuantumUNET.Transport;
|
||||||
|
|
||||||
namespace QSB.MeteorSync.TransformSync
|
namespace QSB.MeteorSync.TransformSync
|
||||||
{
|
{
|
||||||
@ -40,18 +40,30 @@ namespace QSB.MeteorSync.TransformSync
|
|||||||
|
|
||||||
base.Init();
|
base.Init();
|
||||||
SetReferenceTransform(Locator._brittleHollow.transform);
|
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()
|
protected override bool UpdateTransform()
|
||||||
{
|
{
|
||||||
// DebugLog.DebugWrite($"{LogName} - {Time.time - _lastClientSendTime}");
|
if (HasAuthority)
|
||||||
if (Time.time - _lastClientSendTime > GetNetworkSendInterval())
|
|
||||||
{
|
{
|
||||||
return base.UpdateTransform();
|
return base.UpdateTransform();
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
if (!_shouldUpdate)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_shouldUpdate = false;
|
||||||
|
return base.UpdateTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user