예제 #1
0
        public void Serialize(AnimationSerializeContext context)
        {
            context.bw.Write(DefaultHeight);

            context.bw.Write(OneWay);
            context.bw.Write(OneWayThickness);

            if (context.bw.WriteBoolean(HasData))
            {
                context.bw.Write(heightmapData.Bounds);
                context.bw.Write(heightmapData.Data, 0, heightmapData.Width * heightmapData.Height);
            }

            HeightmapInstructionExtensions.Serialize(instructions, context);
        }
예제 #2
0
        public Heightmap(AnimationDeserializeContext context)
        {
            DefaultHeight = context.br.ReadByte();

            OneWay          = context.br.ReadBoolean();
            OneWayThickness = context.br.ReadByte();

            if (context.br.ReadBoolean())
            {
                Rectangle bounds = context.br.ReadRectangle();
                byte[]    data   = context.br.ReadBytes(bounds.Width * bounds.Height);
                heightmapData = new Data2D <byte>(data, bounds);
            }
            else
            {
                heightmapData = default(Data2D <byte>);
            }

            instructions = HeightmapInstructionExtensions.Deserialize(context);
        }