public void PerformPeriodicPingCheck() { if (WaitingOnPingRequests) { return; } ExpandArrayIfNecessary(); for (int id = 0; id < pingProfiles.Length; id++) { PingProfile profile = pingProfiles[id]; if (id == 0) { Assert.IsFalse(IsPlayerConnected(id)); } if (profile.HasBeenPinged) { if (IsPlayerConnected(id) && IsPlayerPingOld(profile)) { requestPingOfPlayer.Invoke(id); } } else { if (IsPlayerConnected(id)) { requestPingOfPlayer.Invoke(id); } } } }
private bool IsPlayerPingOld(PingProfile profile) { return(profile.TimeOfLastSentPingRequest / TicksPerMillisecond + profile.LatestPingMS > repingPeriodMS); }