public virtual void LoadLevel(string levelName, int loadingSceneIndex = -1) { ShowLoadInProgress(); var loadingSceneIndexToUse = (loadingSceneIndex == -1) ? this.loadingSceneIndex : loadingSceneIndex; if (useLoadingScene) { PersistentDataManager.Record(); LoadingScene.SetDestinationScene(levelName); PersistentDataManager.LevelWillBeUnloaded(); SceneManager.LoadScene(loadingSceneIndexToUse); } else { FindLevelManager(); if (levelManager != null) { levelManager.LoadLevel(levelName); } else { PersistentDataManager.Record(); PersistentDataManager.LevelWillBeUnloaded(); SceneManager.LoadScene(levelName); PersistentDataManager.Apply(); } } }
public void Start() { string levelName = GetParameter(0); /*;*/ if (string.IsNullOrEmpty(levelName)) { if (DialogueDebug.LogWarnings) { Debug.LogWarning(string.Format("{0}: Sequencer: LoadLevel() level name is an empty string", DialogueDebug.Prefix)); } } else { if (DialogueDebug.LogInfo) { Debug.Log(string.Format("{0}: Sequencer: LoadLevel({1})", DialogueDebug.Prefix, levelName)); } var levelManager = FindObjectOfType <LevelManager>(); if (levelManager != null) { levelManager.LoadLevel(levelName); } else { PersistentDataManager.Record(); PersistentDataManager.LevelWillBeUnloaded(); GameObject.Find("Loader").SendMessage("LoadLevel", levelName); //Application.LoadLevel(levelName); PersistentDataManager.Apply(); } } Stop(); }
public void Start() { string levelName = GetParameter(0); string spawnpoint = GetParameter(1); bool additive = string.Equals(GetParameter(2), "additive", System.StringComparison.OrdinalIgnoreCase); if (string.IsNullOrEmpty(levelName)) { if (DialogueDebug.logWarnings) { Debug.LogWarning(string.Format("{0}: Sequencer: LoadLevel() level name is an empty string", DialogueDebug.Prefix)); } } else { if (DialogueDebug.logInfo) { Debug.Log(string.Format("{0}: Sequencer: LoadLevel({1})", DialogueDebug.Prefix, GetParameters())); } DialogueLua.SetActorField("Player", "Spawnpoint", spawnpoint); var saveSystem = FindObjectOfType <SaveSystem>(); if (saveSystem != null) { if (additive) { SaveSystem.LoadAdditiveScene(levelName); } else { PersistentDataManager.LevelWillBeUnloaded(); SaveSystem.LoadScene(string.IsNullOrEmpty(spawnpoint) ? levelName : levelName + "@" + spawnpoint); } } else { if (additive) { UnityEngine.SceneManagement.SceneManager.LoadScene(levelName, UnityEngine.SceneManagement.LoadSceneMode.Additive); } else { var levelManager = FindObjectOfType <LevelManager>(); if (levelManager != null) { levelManager.LoadLevel(levelName); } else { PersistentDataManager.Record(); PersistentDataManager.LevelWillBeUnloaded(); UnityEngine.SceneManagement.SceneManager.LoadScene(levelName, UnityEngine.SceneManagement.LoadSceneMode.Single); PersistentDataManager.Apply(); } } } } Stop(); }
public void Start() { string levelName = GetParameter(0); if (string.IsNullOrEmpty(levelName)) { if (DialogueDebug.LogWarnings) { Debug.LogWarning(string.Format("{0}: Sequencer: LoadLevel() level name is an empty string", DialogueDebug.Prefix)); } } else { if (DialogueDebug.LogInfo) { Debug.Log(string.Format("{0}: Sequencer: LoadLevel({1})", DialogueDebug.Prefix, levelName)); } PersistentDataManager.Record(); Application.LoadLevel(levelName); } Stop(); }
public void Start() { string levelName = GetParameter(0); string spawnpoint = GetParameter(1); if (string.IsNullOrEmpty(levelName)) { if (DialogueDebug.LogWarnings) { Debug.LogWarning(string.Format("{0}: Sequencer: LoadLevel() level name is an empty string", DialogueDebug.Prefix)); } } else { if (DialogueDebug.LogInfo) { Debug.Log(string.Format("{0}: Sequencer: LoadLevel({1})", DialogueDebug.Prefix, GetParameters())); } DialogueLua.SetActorField("Player", "Spawnpoint", spawnpoint); var levelManager = FindObjectOfType <LevelManager>(); if (levelManager != null) { levelManager.LoadLevel(levelName); } else { PersistentDataManager.Record(); PersistentDataManager.LevelWillBeUnloaded(); #if UNITY_5_3 || UNITY_5_3_OR_NEWER UnityEngine.SceneManagement.SceneManager.LoadScene(levelName, UnityEngine.SceneManagement.LoadSceneMode.Single); #else Application.LoadLevel(levelName); #endif PersistentDataManager.Apply(); } } Stop(); }
public void Start() { string levelName = GetParameter(0); if (string.IsNullOrEmpty(levelName)) { if (DialogueDebug.LogWarnings) { Debug.LogWarning(string.Format("{0}: Sequencer: LoadLevel() level name is an empty string", DialogueDebug.Prefix)); } } else { if (DialogueDebug.LogInfo) { Debug.Log(string.Format("{0}: Sequencer: LoadLevel({1})", DialogueDebug.Prefix, levelName)); } var levelManager = FindObjectOfType <LevelManager>(); if (levelManager != null) { levelManager.LoadLevel(levelName); } else { PersistentDataManager.Record(); PersistentDataManager.LevelWillBeUnloaded(); #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 Application.LoadLevel(levelName); #else SceneManager.LoadScene(levelName); #endif PersistentDataManager.Apply(); } } Stop(); }
public override void OnEnter() { PersistentDataManager.Record(); Finish(); }
public override void OnEnter() { string level = (levelName == null) ? null : levelName.Value; if (string.IsNullOrEmpty(level)) { LogError("Level name is an empty string"); } else { if (dontDestroyOnLoad.Value) { var root = Owner.transform.root; UnityEngine.Object.DontDestroyOnLoad(root.gameObject); } var levelManager = GameObject.FindObjectOfType <LevelManager>(); if (levelManager != null && !resetDialogueDatabase) { levelManager.LoadLevel(level); } else { PersistentDataManager.LevelWillBeUnloaded(); if (resetDialogueDatabase) { DatabaseResetOptions databaseResetOption = resetToInitialDatabase ? DatabaseResetOptions.RevertToDefault : DatabaseResetOptions.KeepAllLoaded; DialogueManager.ResetDatabase(databaseResetOption); } else { if (resetToInitialDatabase) { LogWarning("Reset To Initial Database is ticked, but it has no effect because Reset Dialogue Database is unticked."); } PersistentDataManager.Record(); } #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 if (async) { if (additive) { asyncOperation = Application.LoadLevelAdditiveAsync(level); } else { asyncOperation = Application.LoadLevelAsync(level); } return; // Don't finish yet. } else { if (additive) { Application.LoadLevelAdditive(level); } else { Application.LoadLevel(level); } #else if (async) { if (additive) { asyncOperation = SceneManager.LoadSceneAsync(level, LoadSceneMode.Additive); } else { asyncOperation = SceneManager.LoadSceneAsync(level); } return; // Don't finish yet. } else { if (additive) { SceneManager.LoadScene(level, LoadSceneMode.Additive); } else { SceneManager.LoadScene(level); } #endif } } } DoneLoadingLevel(); }
public override void OnEnter() { string level = (levelName == null) ? null : levelName.Value; if (string.IsNullOrEmpty(level)) { LogError("Level name is an empty string"); } else { if (dontDestroyOnLoad.Value) { var root = Owner.transform.root; UnityEngine.Object.DontDestroyOnLoad(root.gameObject); } DialogueLua.SetActorField("Player", "Spawnpoint", spawnpoint); var saveSystem = GameObject.FindObjectOfType <SaveSystem>(); if (saveSystem != null) { PersistentDataManager.LevelWillBeUnloaded(); SaveSystem.LoadScene(string.IsNullOrEmpty(spawnpoint.Value) ? levelName.Value : levelName.Value + "@" + spawnpoint.Value); } else { var levelManager = GameObject.FindObjectOfType <LevelManager>(); if (levelManager != null && !resetDialogueDatabase) { levelManager.LoadLevel(level); } else { PersistentDataManager.LevelWillBeUnloaded(); if (resetDialogueDatabase) { DatabaseResetOptions databaseResetOption = resetToInitialDatabase ? DatabaseResetOptions.RevertToDefault : DatabaseResetOptions.KeepAllLoaded; DialogueManager.ResetDatabase(databaseResetOption); } else { if (resetToInitialDatabase) { LogWarning("Reset To Initial Database is ticked, but it has no effect because Reset Dialogue Database is unticked."); } PersistentDataManager.Record(); } if (async) { if (additive) { asyncOperation = SceneManager.LoadSceneAsync(level, LoadSceneMode.Additive); } else { asyncOperation = SceneManager.LoadSceneAsync(level); } return; // Don't finish yet. } else { if (additive) { SceneManager.LoadScene(level, LoadSceneMode.Additive); } else { SceneManager.LoadScene(level); } } } } } DoneLoadingLevel(); }