private void StoreShots(int userID, ServerClientInfo client, List <Shot> shotsList) { var packet = Packet.Obtain(); foreach (Shot shot in shotsList) { int receivedShotSequence = shot.Seq; if (receivedShotSequence > clients[userID].shotSeqReceived) { clients[userID].pendingShots.Add(shot); clients[userID].shotSeqReceived = receivedShotSequence; } } Serializer.ServerSerializeShotAck(packet.buffer, clients[userID].shotSeqReceived); packet.buffer.Flush(); var remoteEp = client.dest; client.channel.Send(packet, remoteEp); packet.Free(); }
private void StoreCommands(int userID, ServerClientInfo client, List <Commands> commandsList) { var packet = Packet.Obtain(); foreach (Commands commands in commandsList) { int receivedCommandSequence = commands.Seq; // Debug.Log($"rcvd {receivedCommandSequence} vs {clients[userID].cmdSeqReceived}"); if (receivedCommandSequence > clients[userID].cmdSeqReceived) { clients[userID].pendingCommands.Add(commands); clients[userID].cmdSeqReceived = receivedCommandSequence; } } Serializer.ServerSerializeAck(packet.buffer, clients[userID].cmdSeqReceived); packet.buffer.Flush(); var remoteEp = client.dest; client.channel.Send(packet, remoteEp); packet.Free(); }