Ejemplo n.º 1
0
    protected override void DeSerialise(byte[] buf, ref int o, int length)
    {
        byte nLocations = buf[o++];

        for (byte i = 0; i < nLocations; i++)
        {
            Locations.Add(new CoarseLocation
            {
                Position = BinarySerializer.DeSerializeVector3Byte(buf, ref o, buf.Length)
            });
        }
        int youIndex  = BinarySerializer.DeSerializeInt16_Le(buf, ref o, buf.Length);
        int preyIndex = BinarySerializer.DeSerializeInt16_Le(buf, ref o, buf.Length);

        byte nAgents = buf[o++];

        for (byte i = 0; i < nAgents; i++)
        {
            Guid guid = BinarySerializer.DeSerializeGuid(buf, ref o, length);
            if (i < nLocations)
            {
                Locations[i].AgentId = guid;
            }
        }

        if (youIndex > 0 && youIndex < nLocations - 1)
        {
            Locations[youIndex].IsYou = true;
        }

        if (preyIndex > 0 && preyIndex < nLocations - 1)
        {
            Locations[preyIndex].IsPrey = true;
        }
    }