private void Load(string name) { XmlNode xnode = MyXml.FirstChild("Data/Battlefields/" + name + ".xml"); palette = Palette.Get(MyXml.GetString(xnode, "palette")); string text = xnode.InnerText; char[] delimiters = new char[] { '\r', '\n', ' ' }; string[] dataLines = text.Split(delimiters, StringSplitOptions.RemoveEmptyEntries); int width = dataLines[0].Length; int height = dataLines.Length; data = new LocalCell[width, height]; for (int j = 0; j < Size.y; j++) for (int i = 0; i < Size.x; i++) points.Add(new ZPoint(i, j)); //for (int j = 0; j < height; j++) for (int i = 0; i < width; i++) data[i, j] = dataLines[j][i]; foreach (ZPoint p in points) SetTile(p, dataLines[p.y][p.x]); }
private void Generate() { //palette = Terrain.palette; palette = Palette.Get("Mountains"); int width = Math.Min(6 + NumberOfCreatures, 27), height = Math.Min(6 + NumberOfCreatures, 22); data = new LocalCell[width, height]; points.Clear(); for (int j = 0; j < Size.y; j++) for (int i = 0; i < Size.x; i++) points.Add(new ZPoint(i, j)); Fill(); }