For my project I need to load a very large document.
The document does not have spaces between the characters, but it does have many lines. My problem comes from the line: lines = Regex.Split(text, string.Empty); This only seperates the characters by lines leading to a single long row of objects instead of a maze. How do I fix this?
string text = System.IO.File.ReadAllText("map.txt");
string[] lines = Regex.Split(text, string.Empty);
int rows = lines.Length;
string[][] levelBase = new string[rows][];
for (int i = 0; i < lines.Length; i++) {
string[] stringsOfLine = Regex.Split(lines*, " ");*
_ levelBase = stringsOfLine;_
* }*
* string[][] jagged = levelBase;*
* for (int y = 0; y < jagged.Length; y++) {*
* for (int x = 0; x < jagged[0].Length; x++) {*
* Debug.Log(jagged[0].Length );*
* switch (jagged[y][x]){*
* case sfloor_valid:
Instantiate(floor_valid, new Vector3(x, -.2f, -y), Quaternion.identity);
_ break;_
case sfloor_obstacle:
Instantiate(floor_obstacle, new Vector3(x, 0, -y), Quaternion.identity);
_ break;_
case sfloor_oob:
Instantiate(floor_OutOfBounds, new Vector3(x, 0, -y), Quaternion.identity);
_ break;_
_ }_
_ }_
_ }_
_ }*_