赞
踩
using UnityEngine; public class BackgroundMusicController : MonoBehaviour { private AudioSource audioSource; void Start() { audioSource = GetComponent<AudioSource>(); PlayMusic(); } public void PlayMusic() { if (!audioSource.isPlaying) { audioSource.Play(); } } public void StopMusic() { if (audioSource.isPlaying) { audioSource.Stop(); } } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。