using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum AudioClipType
{
zhuoqian,
zhuazuoyepiao,
duzuoyepiao,
qianzikaimen
}
public class SoundController : MonoBehaviour {
public static SoundController _instance;
public AudioClip[] audioClips;
public AudioSource audioSource;
// Use this for initialization
void Awake()
{
_instance = this;
}
//设置音效的方法
public void SetAudio(AudioClipType index)
{
audioSource.clip = audioClips[(int)index];
audioSource.Play();
}
//在哪播放在那调用
/*
* SoundController._instance.SetAudio(AudioClipType.zhuoqian);
*
* */
}
音效的管理和调用
最新推荐文章于 2022-08-15 00:48:25 发布