private string getTIXPathFromTextureSet(Dream dream, TextureSet textureSet) { if (string.IsNullOrWhiteSpace(dream.LBDFolder)) { Debug.LogError("Could not get TIX path from dream, dream did not have LBD folder"); return(null); } return(LSDUtil.GetTIXPathFromLBDPath(dream.LBDFolder, textureSet)); }
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); }
public void LoadDream(string dreamPath) { Dream dream = _serializer.Deserialize <Dream>(PathUtil.Combine(Application.streamingAssetsPath, "levels", dreamPath)); if (CurrentDream == null) { BeginDream(dream); } else { Transition(Color.black, dream, false); } }
public void BeginDream(Dream dream) { _forcedSpawnID = null; _canTransition = true; // start a timer to end the dream float secondsInDream = RandUtil.Float(MIN_SECONDS_IN_DREAM, MAX_SECONDS_IN_DREAM); _endDreamTimer = Coroutines.Instance.StartCoroutine(EndDreamAfterSeconds(secondsInDream)); ToriiFader.Instance.FadeIn(Color.black, 3, () => Coroutines.Instance.StartCoroutine(LoadDream(dream))); CurrentSequence = new DreamSequence(); CurrentSequence.Visited.Add(dream); }
public void BeginDream() { TextureSetSystem.SetTextureSet(randomTextureSetFromDayNumber(GameSave.CurrentJournalSave.DayNumber)); string dreamPath = GameSave.CurrentJournalSave.DayNumber == 1 ? JournalLoader.Current.GetFirstDream() : JournalLoader.Current.GetDreamFromGraph(GameSave.CurrentJournalSave.LastGraphX, GameSave.CurrentJournalSave.LastGraphY); _currentDreamPath = dreamPath; Dream dream = _serializer.Deserialize <Dream>(PathUtil.Combine(Application.streamingAssetsPath, dreamPath)); BeginDream(dream); }
public void Transition(Color fadeCol, string dreamPath = null, bool playSound = true, string spawnPointID = null) { if (string.IsNullOrEmpty(dreamPath)) { // choose a random dream that isn't the current dream dreamPath = RandUtil.RandomListElement( JournalLoader.Current.LinkableDreams.Where(d => !d.Equals(_currentDreamPath))); Debug.Log($"Dream path: {dreamPath}, Current dream path: {_currentDreamPath}"); } _currentDreamPath = dreamPath; Dream dream = _serializer.Deserialize <Dream>(PathUtil.Combine(Application.streamingAssetsPath, dreamPath)); Transition(fadeCol, dream, playSound, spawnPointID); }
public void Transition(Color fadeCol, Dream dream, bool playSound = true, string spawnPointID = null) { if (!_canTransition) { return; } Debug.Log($"Linking to {dream.Name}"); _currentlyTransitioning = true; SettingsSystem.CanControlPlayer = false; _forcedSpawnID = spawnPointID; // disable pausing to prevent throwing off timers etc PauseSystem.CanPause = false; if (playSound) { AudioPlayer.Instance.PlayClip(LinkSound, false, "SFX"); } CurrentSequence.Visited.Add(dream); ToriiFader.Instance.FadeIn(fadeCol, 1F, () => { // see if we should switch texture sets if (RandUtil.OneIn(CHANCE_TO_SWITCH_TEXTURES_WHEN_LINKING)) { TextureSetSystem.SetTextureSet( randomTextureSetFromDayNumber(GameSave.CurrentJournalSave.DayNumber)); } Coroutines.Instance.StartCoroutine(LoadDream(dream)); }); }