Exemplo n.º 1
0
 public void Unpause()
 {
     Time.timeScale = 1;
     OnGameUnpaused.Raise();
     Settings.CanMouseLook = true;
     ToriiCursor.Hide();
 }
Exemplo n.º 2
0
        public IEnumerator LoadDream(Dream dream)
        {
            Debug.Log($"Loading dream '{dream.Name}'");

            if (MusicSource != null && MusicSource.isPlaying)
            {
                MusicSource.Stop();
            }

            TextureSetSystem.DeregisterAllMaterials();

            string currentScene = SceneManager.GetActiveScene().name;

            OnLevelPreLoad.Raise();

            SceneManager.LoadScene(DreamScene.ScenePath);
            yield return(null);

            ResourceManager.ClearLifespan("scene");

            CurrentDream = dream;

            // then instantiate the LBD if it has one
            if (dream.Type == DreamType.Legacy)
            {
                LBDLoader.LoadLBD(dream.LBDFolder, dream.LegacyTileMode, dream.TileWidth);
            }

            // load the manifest if it has one
            if (!string.IsNullOrEmpty(dream.Level))
            {
                string levelPath = PathUtil.Combine(Application.streamingAssetsPath, dream.Level);
                LevelLoader.LoadLevel(levelPath);
            }

            ApplyEnvironment(dream.ChooseEnvironment(GameSave.CurrentJournalSave.DayNumber));

            SettingsSystem.CanControlPlayer = true;
            SettingsSystem.CanMouseLook     = true;

            OnLevelLoad.Raise();

            MusicSource = MusicSystem.PlayRandomSongFromDirectory(PathUtil.Combine(Application.streamingAssetsPath,
                                                                                   JournalLoader.Current.MusicFolder));
            OnSongChange.Raise();

            // reenable pausing
            PauseSystem.CanPause = true;

            ToriiCursor.Hide();

            ToriiFader.Instance.FadeOut(1F, () => _currentlyTransitioning = false);
        }