public override void OnInspectorGUI() { DrawDefaultInspector(); StairsGenerator script = (StairsGenerator)target; if (GUILayout.Button("Generate")) { script.GenerateStairs(); } }
public override void ManageMap(bool assembleMap) { if (loadMapFromFile) { // Load the map. LoadMapFromText(); } else { List <string> partialGenomes = new List <string>(); // Generate the map. mapGeneratorScript.SaveMapSize(); for (int i = 0; i < levelsCount; i++) { if (ParameterManager.HasInstance()) { maps.Add(mapGeneratorScript.GenerateMap(seed + i, export)); } else { maps.Add(mapGeneratorScript.GenerateMap()); } if (export) { partialGenomes.Add(mapGeneratorScript.ConvertMapToAB(false)); } mapGeneratorScript.ResetMapSize(); } // Add the stairs. stairsGeneratorScript.GenerateStairs(maps, mapGeneratorScript); // Save the map. if (export) { AddTilesToGenomes(partialGenomes); SaveMLMapAsAB(partialGenomes); SaveMLMapAsText(); } } if (assembleMap) { // Assemble the map. mapAssemblerScript.AssembleMap(maps, mapGeneratorScript.GetWallChar(), mapGeneratorScript.GetRoomChar(), stairsGeneratorScript.GetVoidChar()); // Displace the objects. for (int i = 0; i < maps.Count; i++) { objectDisplacerScript.DisplaceObjects(maps[i], mapAssemblerScript.GetSquareSize(), mapAssemblerScript.GetWallHeight() * i); } } }
public void GenerateStairs() { (level.cells, level.stairsPosition) = StairsGenerator.GenerateStairs( level.criticalPath, level.criticalPathLength, level.startingPosition, level.cells); }