using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using UnityEngine.UI; /// /// 音频管理类 /// public class AudioManager : MonoBehaviour { /// /// 音效管理器实例对象 /// public static AudioManager Instance; private void Awake() { Instance = this; } public int BgIndex = -2; /// /// 播放第index展厅背景音乐 /// /// 展厅索引 public void PlayBg(int index) { if(BgIndex == -2) { BgIndex = -1; } else if (BgIndex != index) { BgIndex = index; H5Controller.PlayBg(index); } } /// /// 播放音效(默认在摄像机位置播放) /// /// 音效文件名 public void PlayAudio(string audioName, float volumn = 1f) { H5Controller.PlayAudio(audioName); } /// /// 停止播放讲解音频 /// public void StopAudio() { H5Controller.StopAudio(); } /// /// 暂停背景音乐 /// public void PauseBackgroundMusic() { H5Controller.PauseBackgroundMusic(); } /// /// 恢复背景音乐 /// public void ResumeBackgroundMusic() { H5Controller.ResumeBackgroundMusic(); } /// /// 背景音乐是否静音 /// public bool IsBgMute; /// /// 设置背景音乐静音 /// public void SetBackgroundMute() { IsBgMute = !IsBgMute; H5Controller.SetBackgroundMute(); } /// /// 移除音乐文件 /// /// 音乐文件名 public void RemoveAudio(string auName) { } }