public void LoadOverworld() { Logger.Log("Load overworld (in editor)"); if (string.IsNullOrWhiteSpace(_overworldName)) { Logger.Warning(Logger.Datawriting, "In order to save the overworld, please fill in an overworld name"); return; } bool overworldNameExists = OverworldLoader.OverworldExists(_overworldName); if (overworldNameExists) { OverworldData overworldData = OverworldLoader.LoadOverworldData(_overworldName); OverworldLoader.LoadOverworldForEditor(overworldData); } EditorSelectedOverworldTileModifierContainer selectedTileModifierContainer = EditorCanvasUI.Instance.SelectedTileModifierContainer as EditorSelectedOverworldTileModifierContainer; selectedTileModifierContainer?.SetInitialModifierValues(); EditorOverworldTileModificationPanel.Instance?.Reset(); EditorOverworldTileModificationPanel.Instance?.DestroyModifierActions(); }
public void Start() { switch (PersistentGameManager.CurrentSceneType) { case SceneType.Overworld: Logger.Log("instantiate overworld sprites, tiles and characters"); if (PersistentGameManager.SceneLoadOrigin == SceneLoadOrigin.Gameplay) { if (PersistentGameManager.OverworldName == "") { PersistentGameManager.SetOverworldName("overworld"); } string overworldName = PersistentGameManager.OverworldName; Logger.Log($"We will load the maze '{overworldName}'"); OverworldData startUpOverworldData = OverworldLoader.LoadOverworldData(overworldName); if (startUpOverworldData == null) { Logger.Error("Could not find the default overworld for startup"); } OverworldLoader.LoadOverworld(startUpOverworldData); if (OverworldGameplayManager.Instance.Overworld == null) { Logger.Log(Logger.Initialisation, "No overworld loaded on startup. Returning"); return; } } // We loaded a overworld scene through the editor. Set up an empty grid for in the editor else { Logger.Log("create empty grid"); EditorCanvasUI.Instance.OverworldModificationPanel.GenerateTiles(); } break; case SceneType.Maze: // We loaded a maze scene through the game. Set up the maze level if (PersistentGameManager.SceneLoadOrigin == SceneLoadOrigin.Gameplay) { if (PersistentGameManager.CurrentSceneName == "") { PersistentGameManager.SetCurrentSceneName("default"); } string mazeName = PersistentGameManager.CurrentSceneName; PersistentGameManager.SetLastMazeLevelName(mazeName); Logger.Log($"We will load the maze '{mazeName}'"); MazeLevelData startUpMazeLevelData = MazeLevelLoader.LoadMazeLevelData(mazeName); if (startUpMazeLevelData == null) { Logger.Error($"Could not find the level {mazeName} for startup. Will load defult level instead."); mazeName = "default"; startUpMazeLevelData = MazeLevelLoader.LoadMazeLevelData(mazeName); } MazeLevelLoader.LoadMazeLevel(startUpMazeLevelData); if (CurrentGameLevel == null) { Logger.Log(Logger.Initialisation, "No level loaded on startup. Returning"); return; } if (CurrentGameLevel.PlayerCharacterSpawnpoints.Count == 0) { return; } PlayableLevelNames = MazeLevelLoader.GetAllPlayableLevelNames(); } // We loaded a maze scene through the editor. Set up an empty grid for in the editor else { Logger.Log("create empty grid"); EditorCanvasUI.Instance.MazeModificationPanel.GenerateTiles(); } break; default: Logger.Error($"Scenetype {PersistentGameManager.CurrentSceneType} is not implemented yet"); break; } }