Beispiel #1
0
        public IEnumerable <byte> Serialize()
        {
            //if (!SomethingChanged) return new byte[]{0};

            var result = new byte[] { 1 }.Concat(CommonSerializer.StringToBytes(Player.Name));

            result = result.Concat(CommonSerializer.Vector2ToBytes(Coordinates));
            result = result.Concat(CommonSerializer.Vector2ToBytes(MoveVector));
            result = result.Concat(BitConverter.GetBytes(Health));
            result = result.Concat(ShipCrew.Serialize());
            result = result.Concat(ShipSupplies.Serialize());

            SomethingChanged = false;
            return(result);
        }