public void ClientRead(ServerNetObject type, IReadMessage msg, float sendingTime) { var posInfo = PhysicsBody.ClientRead(type, msg, sendingTime, parentDebugName: Name); msg.ReadPadBits(); if (posInfo != null) { int index = 0; while (index < subBody.PositionBuffer.Count && sendingTime > subBody.PositionBuffer[index].Timestamp) { index++; } subBody.PositionBuffer.Insert(index, posInfo); } }
public void ClientRead(ServerNetObject type, IReadMessage msg, float sendingTime) { if (type != ServerNetObject.ENTITY_POSITION) { DebugConsole.NewMessage($"Error while reading a network event for the submarine \"{Info.Name} ({ID})\". Invalid event type ({type}).", Color.Red); } var posInfo = PhysicsBody.ClientRead(type, msg, sendingTime, parentDebugName: Info.Name); msg.ReadPadBits(); if (posInfo != null) { int index = 0; while (index < subBody.PositionBuffer.Count && sendingTime > subBody.PositionBuffer[index].Timestamp) { index++; } subBody.PositionBuffer.Insert(index, posInfo); } }