Beispiel #1
0
    public static void ClientSerializeInput(CommandsList clientCommands, BitBuffer buffer)
    {
        buffer.PutByte((byte)PacketType.COMMANDS);
        var unackedCommands = clientCommands.GetUnackedCommands();

        buffer.PutInt(unackedCommands.Count);
        foreach (Commands commands in unackedCommands)
        {
            buffer.PutInt(commands.Seq);
            buffer.PutInt(commands.UserID);
            buffer.PutInt(commands.Up ? 1 : 0);
            buffer.PutInt(commands.Down ? 1 : 0);
            buffer.PutInt(commands.Left ? 1 : 0);
            buffer.PutInt(commands.Right ? 1 : 0);
            buffer.PutInt(commands.Space ? 1 : 0);
            buffer.PutFloat(commands.Rotation);
        }
    }