/// <summary> /// Stops the current music that's playing and plays the music associated with the scene /// </summary> /// <param name="sceneName"> The name of the scene </param> /// <returns> The played Soundclip </returns> public SoundClip PlaySceneMusic(string sceneName) { string musicName = string.Empty; switch (sceneName) { case "1-1": case "1-2": musicName = "You"; break; case "1-3": musicName = "To-Battle"; break; case "2-1": case "2-2": musicName = "Finding-The-Secret-Ruins"; break; case "2-3": musicName = "Ouroboros"; break; case "3-1": case "3-2": musicName = "Illusion-Of-Free-Will"; break; case "3-3": musicName = "Hopeless"; break; case "4-1": case "4-2": musicName = "Forward-March"; break; case "4-3": musicName = "the-great-feat"; break; default: musicName = "Wickwood"; break; } if (curMusic != null) { if (curMusic.name == musicName) { return(curMusic); } curMusic.DeactivateAudioSource(); } try { curMusic = PlaySound(musicName, ESoundChannel.MUSIC, true); } catch (KeyNotFoundException e) { throw new KeyNotFoundException($"AudioManager does not have a sound named {musicName}."); } return(curMusic); }