Exemplo n.º 1
0
        /// <summary>
        /// Writes the block data to the underlying stream.
        /// </summary>
        /// <param name="writer">The writer.</param>
        public override void Write(BinaryWriter writer)
        {
            base.Write(writer);

            writer.Write(Width);
            writer.Write(Height);

            for (int h = 0; h < Height; h++)
            {
                for (int w = 0; w < Width; w++)
                {
                    WaterPatch patch = Patches[h, w];
                    writer.Write(patch.HasWater);
                    writer.Write(patch.Height);
                    writer.Write(patch.Type);
                    writer.Write(patch.ID);
                    writer.Write(patch.Reserved);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MapWaterPatches"/> class.
 /// </summary>
 public MapWaterPatches()
 {
     Patches = new WaterPatch[0, 0];
 }
Exemplo n.º 3
0
        /// <summary>
        /// Reads the block data from the underlying stream.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public override void Read(BinaryReader reader)
        {
            base.Read(reader);

            int width = reader.ReadInt32();
            int height = reader.ReadInt32();

            Patches = new WaterPatch[height, width];

            for (int h = 0; h < height; h++) {
                for (int w = 0; w < width; w++) {
                    WaterPatch patch;
                    patch.HasWater = reader.ReadBoolean();
                    patch.Height = reader.ReadSingle();
                    patch.Type = reader.ReadInt32();
                    patch.ID = reader.ReadInt32();
                    patch.Reserved = reader.ReadInt32();

                    Patches[h, w] = patch;
                }
            }
        }