/// <summary> /// 暂停播放背景音乐 /// </summary> /// <param name="isGradual">是否渐进式</param> public void PauseBackgroundMusic(bool isGradual = true) { BackgroundSource.DOKill(); if (isGradual) { BackgroundSource.DOFade(0, 2).OnComplete(() => { BackgroundSource.Pause(); BackgroundSource.volume = BackgroundVolume; }); } else { BackgroundSource.Pause(); BackgroundSource.volume = BackgroundVolume; } }
/// <summary> /// 暂停播放背景音乐 /// </summary> /// <param name="isGradual">是否渐进式</param> public void PauseBackgroundMusic(bool isGradual = true) { if (_bgPauseTweener != null) { _bgPauseTweener.Kill(); _bgPauseTweener = null; } if (isGradual) { _bgPauseTweener = BackgroundSource.DOFade(0, 2).OnComplete(() => { _bgPauseTweener = null; BackgroundSource.Pause(); BackgroundSource.volume = BackgroundVolume; }); } else { BackgroundSource.Pause(); BackgroundSource.volume = BackgroundVolume; } }