Ejemplo n.º 1
0
    public static HitInfo Deserialize(byte[] bin)
    {
        HitInfo data = new HitInfo();

        data.team = (Team)BitConverter.ToChar(bin, 0);
        data.teammateHealthDelta = BitConverterFloat.NetworkToHostOrder(bin, 1);
        data.enemyHealthDelta    = BitConverterFloat.NetworkToHostOrder(bin, 5);
        data.teammateKnockback   = BitConverterFloat.NetworkToHostOrder(bin, 9);
        data.enemyKnockback      = BitConverterFloat.NetworkToHostOrder(bin, 13);
        data.senderId            = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(bin, 17));
        data.direction           = Vector3.zero;
        data.direction.Deserialize(bin.Skip(21).ToArray());

        return(data);
    }
Ejemplo n.º 2
0
 public static void Deserialize(this Vector3 v, byte[] bin)
 {
     v.x = BitConverterFloat.NetworkToHostOrder(bin, 0);
     v.y = BitConverterFloat.NetworkToHostOrder(bin, 4);
     v.z = BitConverterFloat.NetworkToHostOrder(bin, 8);
 }