NetworkTime.UpdateClient doesn't require NetworkClient anymore

This commit is contained in:
vis2k 2019-03-24 20:17:06 +01:00
parent 8c125d2fd3
commit cd56c6a6f7
2 changed files with 4 additions and 4 deletions

View File

@ -111,7 +111,7 @@ void OnConnected()
// the handler may want to send messages to the client // the handler may want to send messages to the client
// thus we should set the connected state before calling the handler // thus we should set the connected state before calling the handler
connectState = ConnectState.Connected; connectState = ConnectState.Connected;
NetworkTime.UpdateClient(this); NetworkTime.UpdateClient();
connection.InvokeHandler(new ConnectMessage()); connection.InvokeHandler(new ConnectMessage());
} }
else Debug.LogError("Skipped Connect message handling because m_Connection is null."); else Debug.LogError("Skipped Connect message handling because m_Connection is null.");
@ -178,7 +178,7 @@ internal virtual void Update()
// only update things while connected // only update things while connected
if (active && connectState == ConnectState.Connected) if (active && connectState == ConnectState.Connected)
{ {
NetworkTime.UpdateClient(this); NetworkTime.UpdateClient();
} }
} }

View File

@ -50,12 +50,12 @@ internal static NetworkPingMessage GetPing()
return new NetworkPingMessage(LocalTime()); return new NetworkPingMessage(LocalTime());
} }
internal static void UpdateClient(NetworkClient networkClient) internal static void UpdateClient()
{ {
if (Time.time - lastPingTime >= PingFrequency) if (Time.time - lastPingTime >= PingFrequency)
{ {
NetworkPingMessage pingMessage = GetPing(); NetworkPingMessage pingMessage = GetPing();
networkClient.Send(pingMessage); NetworkClient.Send(pingMessage);
lastPingTime = Time.time; lastPingTime = Time.time;
} }
} }