//after a level has been completed, it calls the different functions that each //component needs to reset itself. then it calls the other functions that belong //to the game manager to reset themselves. private void ResetLevel() { thisKey.ResetKey(); thisLevel.ResetLevel(); thisLevel.CreateLevel(); thisTimer.ResetTimer(); ResetIndexValues(); ResetLocations(); levelCount++; DisplayLevel(); }
public override void OnInspectorGUI() { DrawDefaultInspector(); // SEPARATOR GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) }); GUILayout.Label("SINGLE TILE"); // Customizing the inspector a little bit GUILayout.BeginHorizontal(); for (int i = 0; i < grid.tiles.Length; i++) { GameObject tilePrefab = grid.tiles[i]; // We want two buttons per line if (i % 2 == 0 && i != 0) { GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); } if (GUILayout.Button(tilePrefab.name)) { grid.SelectTile(i); grid.DisableLoop(); } } GUILayout.EndHorizontal(); // SEPARATOR GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) }); GUILayout.Label("SEQUENTIAL LOOPS"); GUILayout.BeginHorizontal(); for (int j = 0; j < grid.loops.Length; j++) { if (j % 2 == 0 && j != 0) { GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); } if (GUILayout.Button(grid.loops[j].loopName == "" ? "Loop " + j : grid.loops[j].loopName)) { grid.SelectLoop(j); grid.EnableLoop(); } } GUILayout.EndHorizontal(); // SEPARATOR GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) }); GUILayout.Label("RANDOM LOOPS"); GUILayout.BeginHorizontal(); for (int z = 0; z < grid.randomLoops.Length; z++) { if (z % 2 == 0 && z != 0) { GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); } if (GUILayout.Button(grid.randomLoops[z].loopName == "" ? "Loop " + z : grid.randomLoops[z].loopName)) { grid.SelectRandomLoop(z); grid.EnableRandomLoop(); } } GUILayout.EndHorizontal(); // SEPARATOR GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) }); GUILayout.Label("WARNING AREA!!!"); if (GUILayout.Button("Rebuild Level")) { grid.RebuildLevel(); } if (GUILayout.Button("Reset Level")) { grid.ResetLevel(); } }