Exemplo n.º 1
0
 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;
     }
 }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
        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();
            }
        }