mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
server calls reliable baselien rpc
This commit is contained in:
parent
9d69de6c79
commit
6b51a15cf4
@ -251,6 +251,12 @@ protected virtual void OnClientToServerSync(Vector3? position, Quaternion? rotat
|
||||
}
|
||||
|
||||
// rpc /////////////////////////////////////////////////////////////////
|
||||
[ClientRpc(channel = Channels.Reliable)]
|
||||
void RpcServerToClientBaselineSync(Vector3? position, Quaternion? rotation, Vector3? scale)
|
||||
{
|
||||
Debug.LogWarning("TODO process server->client baseline");
|
||||
}
|
||||
|
||||
// only unreliable. see comment above of this file.
|
||||
[ClientRpc(channel = Channels.Unreliable)]
|
||||
void RpcServerToClientSync(Vector3? position, Quaternion? rotation, Vector3? scale) =>
|
||||
@ -315,7 +321,22 @@ protected virtual void OnServerToClientSync(Vector3? position, Quaternion? rotat
|
||||
// update //////////////////////////////////////////////////////////////
|
||||
void UpdateServerBaseline()
|
||||
{
|
||||
// send a reliable baseline every 1 Hz
|
||||
if (NetworkTime.localTime >= lastServerUnreliableBaselineTime + unreliableBaselineInterval)
|
||||
{
|
||||
// send snapshot without timestamp.
|
||||
// receiver gets it from batch timestamp to save bandwidth.
|
||||
TransformSnapshot snapshot = ConstructSnapshot();
|
||||
|
||||
RpcServerToClientBaselineSync(
|
||||
// only sync what the user wants to sync
|
||||
syncPosition ? snapshot.position : default(Vector3?),
|
||||
syncRotation ? snapshot.rotation : default(Quaternion?),
|
||||
syncScale ? snapshot.scale : default(Vector3?)
|
||||
);
|
||||
|
||||
lastServerUnreliableBaselineTime = NetworkTime.localTime;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateServerDelta()
|
||||
|
Loading…
Reference in New Issue
Block a user