NetworkTransformUnreliable: UpdateClientInterpolation helper function

This commit is contained in:
vis2k 2023-03-14 17:17:33 +08:00
parent 6e142d8cc0
commit 5f1ec83cca

View File

@ -227,16 +227,7 @@ void UpdateClientBroadcast()
} }
} }
void UpdateClient() void UpdateClientInterpolation()
{
// client authority, and local player (= allowed to move myself)?
if (IsClientWithAuthority)
{
UpdateClientBroadcast();
}
// for all other clients (and for local player if !authority),
// we need to apply snapshots from the buffer
else
{ {
// only while we have snapshots // only while we have snapshots
if (clientSnapshots.Count > 0) if (clientSnapshots.Count > 0)
@ -255,6 +246,20 @@ void UpdateClient()
Apply(computed, to); Apply(computed, to);
} }
} }
void UpdateClient()
{
// client authority, and local player (= allowed to move myself)?
if (IsClientWithAuthority)
{
UpdateClientBroadcast();
}
// for all other clients (and for local player if !authority),
// we need to apply snapshots from the buffer
else
{
UpdateClientInterpolation();
}
} }
public override void OnSerialize(NetworkWriter writer, bool initialState) public override void OnSerialize(NetworkWriter writer, bool initialState)