public void SetMusic(MusicHandle handle, float delay)
 {
     if (CurrentlyPlaying != handle)
     {
         StartCoroutine(SwitchMusic(handle, 0.33f));
     }
 }
    /// <summary>
    /// Switches the music with a minor delay.
    /// </summary>
    /// <param name="delay">The delay (in seconds) between stopping the music and starting the next piece.</param>
    /// <param name="handle">The handle of the desired music loop.</param>
    /// <returns>Nothing.</returns>
    private IEnumerator SwitchMusic(MusicHandle handle, float delay)
    {
        AkSoundEngine.PostEvent("musicStop", gameObject);

        yield return(new WaitForSeconds(delay));

        switch (handle)
        {
        case MusicHandle.MusicOnePlay:
            AkSoundEngine.PostEvent("music1Play", gameObject);
            CurrentlyPlaying = MusicHandle.MusicOnePlay;
            break;

        case MusicHandle.MusicQuest:
            AkSoundEngine.PostEvent("musicquest", gameObject);
            CurrentlyPlaying = MusicHandle.MusicQuest;
            break;

        case MusicHandle.MusicStop:
            Debug.Log("PLZ STOP");

            CurrentlyPlaying = MusicHandle.MusicStop;
            break;

        default:
            LogError(handle); break;
        }
    }
 /// <summary>
 /// Sets the currently running background music loop.
 /// The method will first stop any currently playing music (if it is not the same), and start the new music loop.
 /// Stopping the music will stop it in it's entirety.
 /// </summary>
 /// <param name="delay">The desired delay (in seconds) before starting the new music.</param>
 /// <param name="handle">The desired music. MusicOne is used for the menus and quest hub, MusicQuest is used for the battle board.</param>
 public void SetMusic(MusicHandle handle)
 {
     SetMusic(handle, 0.33f);
 }