/// <summary> /// 播放背景音 /// </summary> /// <param name="adClip"></param> public void PlayBgAudio(AudioClip adClip) { if (LoopAudioSource == null || adClip == null || (LoopAudioSource.clip != null && LoopAudioSource.clip.name == adClip.name)) { return; } LoopAudioSource.clip = adClip; LoopAudioSource.Play(); }
public void EnableVoice(bool enable) { if (LoopAudioSource.enabled == enable) { return; } LoopAudioSource.enabled = enable; if (enable) { ResourceItem audioClipUnit = ResourcesManager.Instance.loadImmediate(AudioDefine.GetMapBgAudio((MAPTYPE)GameUserModel.Instance.GameMapID), ResourceType.ASSET); AudioClip clip = audioClipUnit.Asset as AudioClip; AudioManager.Instance.PlayBgAudio(clip); LoopAudioSource.Play(); } }