Ejemplo n.º 1
0
        public override List <byte> SerializeBinary()
        {
            List <byte> itBytes = new List <byte>();

            // uid
            itBytes.AddRange(BinarySerializerUtils.IntToBytes(UniqueId));

            // name
            itBytes.AddRange(BinarySerializerUtils.StrToBytes(Name, GameObject.MAX_NAME_LENGTH));

            // position
            itBytes.AddRange(BinarySerializerUtils.IntToBytes(Position.X));
            itBytes.AddRange(BinarySerializerUtils.IntToBytes(Position.Y));

            // attributes parameters
            byte type  = ItemType;
            int  param = ItemParameter;

            itBytes.AddRange(BinarySerializerUtils.IntToBytes(param));
            itBytes.Add(type);

            return(itBytes);
        }
Ejemplo n.º 2
0
        public override List <byte> SerializeBinary()
        {
            List <byte> crBytes = new List <byte>();

            // uid
            crBytes.AddRange(BinarySerializerUtils.IntToBytes(UniqueId));

            // name
            crBytes.AddRange(BinarySerializerUtils.StrToBytes(Name, GameObject.MAX_NAME_LENGTH));

            // position
            crBytes.AddRange(BinarySerializerUtils.IntToBytes(Position.X));
            crBytes.AddRange(BinarySerializerUtils.IntToBytes(Position.Y));

            // creature attributes
            byte type = CreatureType;

            crBytes.AddRange(BinarySerializerUtils.IntToBytes(BaseHitPoints));
            crBytes.AddRange(BinarySerializerUtils.IntToBytes(BaseAttack));
            crBytes.AddRange(BinarySerializerUtils.IntToBytes(BaseDeffense));
            crBytes.Add(type);

            return(crBytes);
        }