public void LoadOverworldEditor() { PersistentGameManager.SceneLoadOrigin = SceneLoadOrigin.Editor; if (PersistentGameManager.OverworldName == "") { PersistentGameManager.SetOverworldName("overworld"); } PersistentGameManager.SetLastMazeLevelName(PersistentGameManager.CurrentSceneName); PersistentGameManager.SetCurrentSceneName(PersistentGameManager.OverworldName); PhotonNetwork.LoadLevel("Overworld"); }
public void Launch() { if (GameRules.GameMode == GameMode.Campaign) { PersistentGameManager.SetOverworldName("overworld"); PersistentGameManager.SetCurrentSceneName(PersistentGameManager.OverworldName); PhotonNetwork.LoadLevel("Overworld"); } else { PersistentGameManager.SetLastMazeLevelName("default"); PersistentGameManager.SetCurrentSceneName("default"); PhotonNetwork.LoadLevel("Maze"); } }
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; } }