예제 #1
0
        public void GenerateNewMap(int width, int height)
        {
            cells = new TerrainCell[width, height];

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    cells[x, y] = new TerrainCell(new Vector2Int(x, y), 0);
                }
            }
        }
예제 #2
0
        public void ReadXml(XmlReader reader)
        {
            int width  = Convert.ToInt32(reader["Width"]);
            int height = Convert.ToInt32(reader["Height"]);

            cells = new TerrainCell[width, height];
            if (reader.ReadToDescendant(typeof(TerrainCell).Name))
            {
                while (reader.MoveToContent() == XmlNodeType.Element && reader.LocalName == typeof(TerrainCell).Name)
                {
                    var cell = new TerrainCell(Vector2Int.Zero, 0);
                    cell.ReadXml(reader);
                    cells[cell.Position.X, cell.Position.Y] = cell;
                }
            }
        }