private void UpdateAudio() { E_Music currentMusic = AudioManager.Instance.CurrentMusic; if (currentMusic == E_Music.None) { AudioManager.Instance.PlayMusic(E_Music.WorldMap); } }
public void PlayMusic(E_Music requestedMusic) { if (m_currentMusic == requestedMusic) { return; } AudioSource fadeOutMusic = null; switch (m_currentMusic) { case E_Music.WorldMap: m_lastWorldMapMusicTime = m_worldMapMusic.time; // technically incorrect due to the fadeout fadeOutMusic = m_worldMapMusic; break; case E_Music.Battle: fadeOutMusic = m_battleMusic; break; case E_Music.BossBattle: fadeOutMusic = m_bossBattleMusic; break; default: break; } m_currentMusic = requestedMusic; AudioSource fadeInMusic = null; switch (m_currentMusic) { case E_Music.WorldMap: m_worldMapMusic.time = m_lastWorldMapMusicTime; fadeInMusic = m_worldMapMusic; break; case E_Music.Battle: fadeInMusic = m_battleMusic; break; case E_Music.BossBattle: fadeInMusic = m_bossBattleMusic; break; default: Debug.Break(); break; } ChangeMusic(fadeOutMusic, fadeInMusic); }