void UpdatePlayerMusicTime() { if (DaggerfallUnity.Instance.WorldTime.DaggerfallDateTime.IsDay) { currentPlayerMusicTime = PlayerMusicTime.Day; } else { currentPlayerMusicTime = PlayerMusicTime.Night; } }
void Update() { if (!songPlayer) { return; } // If streaming world is set, we can ignore track changes before init complete // This helps prevent music starting during first load or on wrong playlist if (StreamingWorld) { if (StreamingWorld.IsInit) { return; } } // Update context UpdatePlayerMusicEnvironment(); UpdatePlayerMusicWeather(); UpdatePlayerMusicTime(); // Update current playlist if context changed bool overrideSong = false; if (currentPlayerMusicEnvironment != lastPlayerMusicEnvironment || currentPlayerMusicWeather != lastPlayerMusicWeather || currentPlayerMusicTime != lastPlayerMusicTime || (!songPlayer.IsPlaying && playSong) || playingArrestedMusic != playerEntity.Arrested) { lastPlayerMusicEnvironment = currentPlayerMusicEnvironment; lastPlayerMusicWeather = currentPlayerMusicWeather; lastPlayerMusicTime = currentPlayerMusicTime; lastPlaylist = currentPlaylist; // Get playlist for current context AssignPlaylist(); // If current playlist is different from last playlist, pick a song from the current playlist if (currentPlaylist != lastPlaylist) { SelectCurrentSong(); overrideSong = true; } } // Play song if no song was playing or if playlist changed // Switch to another random song to prevent fatigue of hearing same song repeatedly if (!songPlayer.IsPlaying || overrideSong) { PlayCurrentSong(); } }
void Update() { if (!songPlayer) { return; } // If streaming world is set, we can ignore track changes before init complete // This helps prevent music starting during first load or on wrong playlist if (StreamingWorld) { if (StreamingWorld.IsInit) { return; } } // Update context UpdatePlayerMusicEnvironment(); UpdatePlayerMusicWeather(); UpdatePlayerMusicTime(); // Switch playlists if context changes or if not playing then select a new song bool overrideSong = false; if (currentPlayerMusicEnvironment != lastPlayerMusicEnvironment || currentPlayerMusicWeather != lastPlayerMusicWeather || currentPlayerMusicTime != lastPlayerMusicTime || (!songPlayer.IsPlaying && playSong)) { // Keep song if playing the same weather, but not when entering dungeons if (currentPlayerMusicWeather != PlayerMusicWeather.Normal && currentPlayerMusicWeather == lastPlayerMusicWeather && currentPlayerMusicEnvironment != PlayerMusicEnvironment.DungeonInterior) { return; } // Change song lastPlayerMusicEnvironment = currentPlayerMusicEnvironment; lastPlayerMusicWeather = currentPlayerMusicWeather; lastPlayerMusicTime = currentPlayerMusicTime; AssignPlaylist(); SelectCurrentSong(); overrideSong = true; } // Play song if (!songPlayer.IsPlaying || overrideSong) { PlayCurrentSong(); } }
void Update() { if (!songPlayer) { return; } // Update context UpdatePlayerMusicEnvironment(); UpdatePlayerMusicWeather(); UpdatePlayerMusicTime(); // Update current playlist if context changed bool overrideSong = false; if (currentPlayerMusicEnvironment != lastPlayerMusicEnvironment || currentPlayerMusicWeather != lastPlayerMusicWeather || currentPlayerMusicTime != lastPlayerMusicTime || (!songPlayer.IsPlaying && playSong) || playingArrestedMusic != playerEntity.Arrested) { lastPlayerMusicEnvironment = currentPlayerMusicEnvironment; lastPlayerMusicWeather = currentPlayerMusicWeather; lastPlayerMusicTime = currentPlayerMusicTime; lastPlaylist = currentPlaylist; // Get playlist for current context AssignPlaylist(); // If current playlist is different from last playlist, pick a song from the current playlist if (currentPlaylist != lastPlaylist) { SelectCurrentSong(); overrideSong = true; } } // Play song if no song was playing or if playlist changed // Switch to another random song to prevent fatigue of hearing same song repeatedly if (!songPlayer.IsPlaying || overrideSong) { PlayCurrentSong(); } }
void UpdatePlayerMusicTime() { if (DaggerfallUnity.Instance.WorldTime.DaggerfallDateTime.IsDay) currentPlayerMusicTime = PlayerMusicTime.Day; else currentPlayerMusicTime = PlayerMusicTime.Night; }
void Update() { if (!songPlayer) return; // If streaming world is set, we can ignore track changes before init complete // This helps prevent music starting during first load or on wrong playlist if (StreamingWorld) { if (StreamingWorld.IsInit) return; } // Update context UpdatePlayerMusicEnvironment(); UpdatePlayerMusicWeather(); UpdatePlayerMusicTime(); // Switch playlists if context changes or if not playing then select a new song bool overrideSong = false; if (currentPlayerMusicEnvironment != lastPlayerMusicEnvironment || currentPlayerMusicWeather != lastPlayerMusicWeather || currentPlayerMusicTime != lastPlayerMusicTime || (!songPlayer.IsPlaying && playSong)) { // Keep song if playing the same weather, but not when entering dungeons if (currentPlayerMusicWeather != PlayerMusicWeather.Normal && currentPlayerMusicWeather == lastPlayerMusicWeather && currentPlayerMusicEnvironment != PlayerMusicEnvironment.DungeonInterior) { return; } // Change song lastPlayerMusicEnvironment = currentPlayerMusicEnvironment; lastPlayerMusicWeather = currentPlayerMusicWeather; lastPlayerMusicTime = currentPlayerMusicTime; AssignPlaylist(); SelectCurrentSong(); overrideSong = true; } // Play song if (!songPlayer.IsPlaying || overrideSong) PlayCurrentSong(); }