mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkTime: SendPing method added.
This commit is contained in:
parent
d304ada178
commit
fe32a0569f
@ -141,17 +141,21 @@ internal static void UpdateClient()
|
||||
{
|
||||
// localTime (double) instead of Time.time for accuracy over days
|
||||
if (localTime >= lastPingTime + PingInterval)
|
||||
{
|
||||
// send raw predicted time without the offset applied yet.
|
||||
// we then apply the offset to it after.
|
||||
NetworkPingMessage pingMessage = new NetworkPingMessage
|
||||
(
|
||||
localTime,
|
||||
predictedTime
|
||||
);
|
||||
NetworkClient.Send(pingMessage, Channels.Unreliable);
|
||||
lastPingTime = localTime;
|
||||
}
|
||||
SendPing();
|
||||
}
|
||||
|
||||
// Separate method so we can call it from NetworkClient directly.
|
||||
internal static void SendPing()
|
||||
{
|
||||
// send raw predicted time without the offset applied yet.
|
||||
// we then apply the offset to it after.
|
||||
NetworkPingMessage pingMessage = new NetworkPingMessage
|
||||
(
|
||||
localTime,
|
||||
predictedTime
|
||||
);
|
||||
NetworkClient.Send(pingMessage, Channels.Unreliable);
|
||||
lastPingTime = localTime;
|
||||
}
|
||||
|
||||
// client rtt calculation //////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user