/// <summary> /// Loads a level by the given level scene name. /// </summary> /// <param name="levelSceneName">The level's scene name.</param> public static void LoadLevel(string levelSceneName) { List <GameLevelInfo> foundGLI = sGameLevelRegistryList.Where(gli => gli.LevelSceneName == levelSceneName).ToList(); if (foundGLI.Count < 1) { return; } GameLevelInfo gliToLoad = foundGLI[0]; LoadLevelInternal(gliToLoad); }
/// <summary> /// Internal function for loading a level. /// </summary> /// <param name="gli">The game level info</param> internal static void LoadLevelInternal(GameLevelInfo gli) { SceneManager.LoadScene(gli.LevelSceneName); }
/// <summary> /// Registers a new level with the given <see cref="GameLevelInfo"/> data structure. /// </summary> /// <param name="levelInfo">The level info</param> /// <returns>The id of the level.</returns> public static int RegisterLevel(GameLevelInfo levelInfo) { sGameLevelRegistryList.Add(levelInfo); return(sGameLevelRegistryList.Count - 1); }