void OnGUI() { // Check for errors if (EditorUtilityFunctions.GetRoomPrefab() != null)// If room prefab exists { GUILayout.Label("Room prefab already exists!\nScript will not rerun in order to ensure this prefab isn't overwritten. Delete the prefab if you want to regenerate the map.", EditorStyles.boldLabel); } else if (EditorUtilityFunctions.GetTilePrefabs().Count > 0)// If any Tiles exist { GUILayout.Label("Tile prefabs already exist!\nScript will not rerun in order to ensure these prefabs aren't overwritten. Delete the prefabs if you want to regenerate the map.", EditorStyles.boldLabel); } else if (GameObject.Find("Level") != null) { GUILayout.Label("This scene already has a Level GameObject!\nThe script will not continue.", EditorStyles.boldLabel); } else { GUILayout.Label("Generate Map Into Current Scene", EditorStyles.boldLabel); GUILayout.Label("", EditorStyles.boldLabel); inputMap = (Texture2D)EditorGUILayout.ObjectField("Input Map Texture:", inputMap, typeof(Texture2D), false); templateGame = (TemplateGame)EditorGUILayout.EnumPopup("Game:", templateGame); if (templateGame == TemplateGame.metroid) { metroidRooms = (TextAsset)EditorGUILayout.ObjectField("Room Grouping:", metroidRooms, typeof(TextAsset), false); } if (inputMap == null) { GUILayout.Label("Input map texture not provided!\nAdd an input map to run the script!", EditorStyles.boldLabel); } else if (templateGame == TemplateGame.metroid && metroidRooms == null) { GUILayout.Label("Room groupings not provided!\nAdd room groupings to continue.", EditorStyles.boldLabel); } else if (GUILayout.Button("Generate!")) { Texture2D newSpriteSheet; int[,] mapAsTileIndices; Parse(out newSpriteSheet, out mapAsTileIndices); Generate(newSpriteSheet, mapAsTileIndices); Debug.Log("Map Generation Successful! Check your hierarchy view and _GeneratedAssets folder for new content."); this.Close(); } } }
public IntroductionGameState(TemplateGame game) { this.game = game; }
public ResultGameState(TemplateGame game) { this.game = game; }
public PlayGameState(TemplateGame game) { this.game = game; }
public QuestionGameState(TemplateGame game) { this.game = game; }