예제 #1
0
        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();
                }
            }
        }
예제 #2
0
 public virtual void RestartGame()
 {
     ShowLoadInProgress();
     if (useLoadingScene)
     {
         PersistentDataManager.LevelWillBeUnloaded();
         DialogueManager.ResetDatabase(DatabaseResetOptions.RevertToDefault);
         LoadingScene.SetDestinationScene(firstGameplaySceneIndex);
         SceneManager.LoadScene(loadingSceneIndex);
     }
     else
     {
         FindLevelManager();
         if (levelManager != null)
         {
             levelManager.RestartGame();
         }
         else
         {
             PersistentDataManager.LevelWillBeUnloaded();
             DialogueManager.ResetDatabase(DatabaseResetOptions.RevertToDefault);
             SceneManager.LoadScene(firstGameplaySceneIndex);
         }
     }
 }