void Update() { if (!songPlayer) { return; } // Update context UpdatePlayerMusicEnvironment(); UpdatePlayerMusicWeather(); // Switch playlists if context changes or if not playing then select a new song bool overrideSong = false; if (currentPlayerMusicEnvironment != lastPlayerMusicEnvironment || currentPlayerMusicWeather != lastPlayerMusicWeather || !songPlayer.IsPlaying) { lastPlayerMusicEnvironment = currentPlayerMusicEnvironment; lastPlayerMusicWeather = currentPlayerMusicWeather; AssignPlaylist(); SelectCurrentSong(); overrideSong = true; } // Play song if (!songPlayer.IsPlaying || overrideSong) { PlayCurrentSong(); } }
void UpdatePlayerMusicWeather() { if (!playerWeather) { return; } switch (playerWeather.WeatherType) { case WeatherType.Overcast: case WeatherType.Fog: case WeatherType.Rain: case WeatherType.Thunder: currentPlayerMusicWeather = PlayerMusicWeather.Rain; break; case WeatherType.Snow: currentPlayerMusicWeather = PlayerMusicWeather.Snow; break; default: currentPlayerMusicWeather = PlayerMusicWeather.Normal; break; } }
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 UpdatePlayerMusicWeather() { if (!playerWeather) { return; } switch (playerWeather.WeatherType) { case PlayerWeather.WeatherTypes.Rain_Normal: currentPlayerMusicWeather = PlayerMusicWeather.Rain; break; case PlayerWeather.WeatherTypes.Snow_Normal: currentPlayerMusicWeather = PlayerMusicWeather.Snow; break; default: currentPlayerMusicWeather = PlayerMusicWeather.Normal; break; } }
void UpdatePlayerMusicWeather() { if (!playerWeather) return; switch (playerWeather.WeatherType) { case PlayerWeather.WeatherTypes.Rain_Normal: currentPlayerMusicWeather = PlayerMusicWeather.Rain; break; case PlayerWeather.WeatherTypes.Snow_Normal: currentPlayerMusicWeather = PlayerMusicWeather.Snow; break; default: currentPlayerMusicWeather = PlayerMusicWeather.Normal; break; } }
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(); }