/// <summary> /// 停止播放背景音乐 /// </summary> public static void stopBGMClip() { AudioSourceControl control = Camera.main.GetComponent <AudioSourceControl>(); if (control != null) { control.stopBGMClip(); } }
private void Awake() { CommonData.GameStatus = 0; gameFinshAnimTime = 3f; uiMasterControl = gameObject.AddComponent <UIMasterControl>(); audioSourceControl = gameObject.AddComponent <AudioSourceControl>(); audioSourceControl.stopBGMClip(); initData(); }
/// <summary> /// 是否播放音乐监听 /// </summary> /// <param name="toggle"></param> /// <param name="value"></param> public void radioBTOnClick(Toggle radioBT, bool value, long data) { if (radioBT.name.Equals("MusicOn") && value == true) { if (!audioSourceControl.isPlayBGMClip()) { audioSourceControl.playBeforeBGMClip(); } } else if (radioBT.name.Equals("MusicOff") && value == true) { audioSourceControl.stopBGMClip(); } }