public void Deserialize(BinaryReader binaryReader) { Height = binaryReader.ReadInt32(); Width = binaryReader.ReadInt32(); SerializeHelper.Map = this; var length1 = binaryReader.ReadInt32(); for (int i = 0; i < length1; i++) { Cells.Add(SerializeHelper.DeserializeMapCell(binaryReader)); } var stringList = new List <Guid>(); var length = binaryReader.ReadInt32(); for (int i = 0; i < length; i++) { stringList.Add(new Guid(binaryReader.ReadBytes(16))); } MapGenerator = new MapGenerator(stringList.ToArray()); foreach (MapCell ourCell in Cells.Where(c => typeof(MapCell).IsAssignableFrom(c.GetType()))) { ourCell.NormalizeLayering(); } }
public Map(int width, int height, BasicMapGenerator mapGenerator) { Players = new List <Player>(); MapGenerator = mapGenerator; Height = height; Width = width; Cells = new List <Cell>(); TextCells = new List <TextCell>(); }