//_______________________________________________________________________ //The Sacred Worldgenerator, mess with it veril88888888y\\ //TODO: Make a world generator public void GenerateDebugWorld() { Debug.Log ("Starting Worldgen"); int x = 0; int y = 0; int z =0; int i = 1; while (x < worldsize + 1) { //Generate tiles one line at a time Transform t = Instantiate(TileFab,new Vector3(x, y, z), Quaternion.identity) as Transform; // GameObject g = t.gameObject; TileArray.Add (t.gameObject); x++; if (x == worldsize + 1 && z < worldsize) { x = ZERO; z++; } if (x == worldsize + 1 && z == worldsize && y > (-1*ylimit)) { x = ZERO; z = ZERO; y-=2; } // Debug.Log("Made Tile: " + x + ", " + y + ", " + z + ". Number: " + i); //comment out before building to run faster i++; } Debug.Log("Tile Array has " + TileArray.Count + " entries!"); int j = ZERO; foreach (GameObject obj in TileArray) { j++; foreach (var comp in obj.GetComponents<Component>()) { //Debug stuff, remove later Debug.Log (comp.ToString()); } terra = obj.GetComponent<TerrainTile>() ; terra.SetTerrainTile (obj.transform.position); terra.updateScript (); obj.SetActive (false); //set inactive to prevent lag on game start by instaspawning all objects. } activeLevel = ZERO; initializeDictionary (); //add tilearray to dictionary ChangeActiveLevel (); //set appropriate layer active }