public static Offset <global::FlatBuffersProtocol.Enemy> Encode(WebProtocol.FlatBuffersProtocol.Enemy source, FlatBufferBuilder fbb)
        {
            Offset <global::FlatBuffersProtocol.Vec3> positionOffset = new Offset <global::FlatBuffersProtocol.Vec3>();

            if (source.position != null)
            {
                positionOffset = Encode(source.position, fbb);
            }
            global::FlatBuffersProtocol.Enemy.StartInventoryIdsVector(fbb, source.inventoryIds.Count);
            for (int i = source.inventoryIds.Count - 1; i >= 0; i--)
            {
                fbb.AddInt(source.inventoryIds[i]);
            }
            VectorOffset inventoryIdsOffset = fbb.EndVector();
            Offset <global::FlatBuffersProtocol.Weapon> weaponOffset = new Offset <global::FlatBuffersProtocol.Weapon>();

            if (source.weapon != null)
            {
                weaponOffset = Encode(source.weapon, fbb);
            }
            global::FlatBuffersProtocol.Enemy.StartEnemy(fbb);
            global::FlatBuffersProtocol.Enemy.AddId(fbb, source.id);
            global::FlatBuffersProtocol.Enemy.AddPosition(fbb, positionOffset);
            global::FlatBuffersProtocol.Enemy.AddInventoryIds(fbb, inventoryIdsOffset);
            global::FlatBuffersProtocol.Enemy.AddWeapon(fbb, weaponOffset);
            global::FlatBuffersProtocol.Enemy.AddTeamId(fbb, source.teamId);
            return(global::FlatBuffersProtocol.Enemy.EndEnemy(fbb));
        }
 public static void Decode(WebProtocol.FlatBuffersProtocol.Enemy destination, global::FlatBuffersProtocol.Enemy source)
 {
     destination.id = source.Id;
     if (source.Position.HasValue)
     {
         destination.position = FlatBuffersFacility.Pool.Get <FlatBuffersProtocol.Vec3>();
         Decode(destination.position, source.Position.Value);
     }
     for (int i = 0; i < source.InventoryIdsLength; i++)
     {
         destination.inventoryIds.Add(source.InventoryIds(i));
     }
     if (source.Weapon.HasValue)
     {
         destination.weapon = FlatBuffersFacility.Pool.Get <FlatBuffersProtocol.Weapon>();
         Decode(destination.weapon, source.Weapon.Value);
     }
     destination.teamId = source.TeamId;
 }