void OnReceivePacket(ushort type, Stream stream) { switch (type) { case (ushort)UserPacketType.TimedPosition: PlayerInputPacket playerInput = new PlayerInputPacket(); idReceived = playerInput.Deserialize(stream); OnFinishDeserializing(PlayerPositionReconciliationChecker, playerInput.payload); //SetPlayerPosition(playerInput.payload); break; } }
private void OnInputReceived(NetPacketReader reader, NetPeer peer) { if (peer.Tag == null) { return; } // dezerialize cachedCommand.Deserialize(reader); var player = (ServerPlayer)peer.Tag; player.ApplyInput(cachedCommand, logicTimer.fd); }
private void OnInputReceived(NetPacketReader reader, NetPeer peer) { if (peer.Tag == null) { return; } _cachedCommand.Deserialize(reader); var player = (ServerPlayer)peer.Tag; bool antilagApplied = _playerManager.EnableAntilag(player); player.ApplyInput(_cachedCommand, LogicTimer.FixedDelta); if (antilagApplied) { _playerManager.DisableAntilag(); } }