public ServerLoop(Action <TimeSpan> onStep) { for (int i = 0; i < SLEEP_TIME_COUNT; i++) { sleepTimes.Enqueue(TimeSpan.FromMilliseconds(1)); } this.onStep = onStep; }
public void QueueOrientation(uint ms, Quaternion orient) { uint lastMs = 0; if (orientBuffer.Count > 0) { lastMs = orientBuffer.Peek().Tick; } receivedOrientTime += SeqDiff(ms, lastMs); if (orientBuffer.Count == orientBuffer.Capacity) { FLLog.Warning("Net", "Something bad happened lerp orient"); receivedOrientTime = 0; orientBuffer.Clear(); } orientBuffer.Enqueue(new OrientState() { Tick = ms, Orient = orient }); }
public void QueuePosition(uint ms, Vector3 pos) { uint lastMs = 0; if (posBuffer.Count > 0) { lastMs = posBuffer.Peek().Tick; } receivedPosTime += SeqDiff(ms, lastMs); if (posBuffer.Count == posBuffer.Capacity) { FLLog.Warning("Net", "Something bad happened lerp pos"); receivedPosTime = 0; posBuffer.Clear(); } posBuffer.Enqueue(new PosState() { Tick = ms, Pos = pos }); }