/*int[,] map = * { * {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1}, * {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0}, * {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, * {0, 0, 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, * {0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, * {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0}, * {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, * {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, * {1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1} * }; */ // Use this for initialization void Awake() { //CellularAutomata(); //BuildMap(); PlatformGenerator pg = new PlatformGenerator(); replaceArea(5, 0, pg.CreateIsland(40, 40)); replaceArea(10, 50, pg.CreateIsland(20, 40)); replaceArea(80, 70, pg.CreateIsland(30, 50)); replaceArea(60, 40, pg.CreateIsland(20, 30)); replaceArea(145, 55, pg.CreateIsland(30, 60)); replaceArea(100, 5, pg.CreateIsland(30, 60)); map[0, width / 2] = 2; GameObject clone = new GameObject(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { switch (map[height - y - 1, x]) { case Tiles.GROUND_TILE: clone = Instantiate(GTile, new Vector3(x, y, 0), Quaternion.identity); break; case Tiles.PLAYER: GameObject temp = Instantiate(Player, new Vector3(x, y, 0), Quaternion.identity); C_PlayerController controller = temp.GetComponent <C_PlayerController> (); controller.spawn = new Vector2(x, y); break; case Tiles.HAZARD: clone = Instantiate(Hazard, new Vector3(x, y, 0), Quaternion.identity); break; case Tiles.RAMP_LEFT: clone = Instantiate(Ramp_Left, new Vector3(x, y, 0), Quaternion.identity); break; case Tiles.RAMP_RIGHT: clone = Instantiate(Ramp_Right, new Vector3(x, y, 0), Quaternion.identity); break; default: break; } // Puts objects under "Level" Hierarchy. clone.transform.parent = GameObject.Find("Level").transform; } } }