Exemplo n.º 1
0
	public void Pong(NetMsgs.Pong msg) {
		pongTimeout = Mathf.Max(pongTimeout, maxPongTimeout);
		
		var millis = Utils.ReadMilliseconds();
		var delta = millis - msg.time;
		pings[nextPing] = (int)delta;
		++nextPing;
		if (nextPing >= pings.Length) {
			nextPing = 0;
			pingFull = true;
		}

		if (pingFull) {
			ping = 0;

			for (int i = 0; i < pings.Length; ++i) {
				ping += pings[i];
			}

			if (ping < 0) {
				ping = 0;
			}

			ping /= pings.Length;
		}
	}
Exemplo n.º 2
0
 void OnNetMsg(NetMsgs.Pong msg, ActorReplicationChannel channel)
 {
     channel.Pong(msg);
 }