public static void LoadPreviousScene() { if (SceneHistory.Count < 2) { Debug.LogWarning("No scene to return to"); return; } CallSceneChanging(); SceneHistory.Pop(); SceneManager.LoadScene(CurrentScene); }
/// <summary> /// Update the StoryBoard. /// </summary> /// <param name="dt">The delta time.</param> /// <param name="input">The input item if any.</param> public static bool Update(TimeSpan dt, GenericMessage message) { // The STORYBOARD should only response to Low Level Game Events like SceneSwitch if (message is Message_SceneSwitch) { if (null != CurrentScene.mp) { CurrentScene.mp.Pause(); CurrentScene.mp.PlaybackSession.Position = TimeSpan.Zero; } Message_SceneSwitch mss = message as Message_SceneSwitch; // find the scene if (SceneDictionary.ContainsKey(mss.TargetScene)) { // push the scene on to the history SceneHistory.Push(CurrentScene); // switch and kill the message CurrentScene = SceneDictionary[mss.TargetScene]; CurrentScene.Reset(); if (AudioManager.AudioDictionary.TryGetValue(mss.TargetScene, out CurrentScene.mp)) { CurrentScene.mp.Play(); } } return(true); } else if (message is Message_GoBack) { // check to see if the history list is empty if (SceneHistory.Count == 0) { //Do nothing } else { // Pop the scene from the history list and set it as the current scene CurrentScene = SceneHistory.Pop(); CurrentScene.Reset(); } return(true); } return(false); }