public static string GetNextLevelToLoad() { string nextSceneName; var stateList = gameScenes[GameManager.gameState]; var currentIndex = stateList.FindIndex(levelName => levelName == _currentLevelName); if (!gameScenes.ContainsKey(GameManager.gameState)) { DebugScript.LogError(typeof(SceneManagement), "Current GameMode isn't declared in Dictionary!\n Returning to Menu"); nextSceneName = "Menu"; } else if (currentIndex + 1 >= stateList.Count) { DebugScript.Log(typeof(SceneManagement), "At the end of the declared scene list\n Returning to Menu"); nextSceneName = "Menu"; } else { nextSceneName = stateList[currentIndex + 1]; } return(nextSceneName); }
static void OnLoadOperationComplete(AsyncOperation ao) { if (_loadOperations.Contains(ao)) { _loadOperations.Remove(ao); hasSceneChanged = true; } DebugScript.Log(typeof(SceneManagement), "Load Complete"); }