private void PlayTypewriteBase(SoundType.UI typewrite, float interval, int times, float volume) { AudioClip clip = ResourcesMgr.Instance.Load <AudioClip>(typewrite); if (interval == -1) { interval = clip.length; } if (isPlayTypewrite == false) { StartCoroutine(PlayOneShot(clip, interval, times, volume)); } }
/// <summary> /// 播放打字音效 /// </summary> /// <param name="typewrite"></param> /// <param name="interval"></param> /// <param name="times"></param> /// <param name="volume"></param> public void PlayTypewrite(SoundType.UI typewrite, float interval = -1, int times = 200, float volume = 1) { PlayTypewriteBase(typewrite, interval, times, volume); }
public void PlayTypewrite(SoundType.UI typewrite, float interval, int times) { PlayTypewriteBase(typewrite, interval, times, 1); }
public void PlayTypewrite(SoundType.UI typewrite, int times, float volume) { PlayTypewriteBase(typewrite, -1, times, volume); }
public void PlayTypewrite(SoundType.UI typewrite, int times) { PlayTypewriteBase(typewrite, -1, times, 1); }
public void PlayTypewrite(SoundType.UI typewrite, float interval) { PlayTypewriteBase(typewrite, interval, 200, 1); }
public void PlayTypewrite(SoundType.UI typewrite, float interval, float volume) { PlayTypewriteBase(typewrite, interval, 200, volume); }
/// <summary> /// 播放音效 /// </summary> /// <param name="effectName">音效名字</param> /// <param name="cover">是否覆盖上一个没有播完的音效</param> /// <param name="volume">音效大小</param> public void PlayEffect(SoundType.UI effectName, bool cover = false, float volume = 1f) { PlayEffectBase(effectName, cover, volume); }
/// <summary> /// 播放背景音 /// </summary> /// <param name="bgName">背景音乐名字</param> /// <param name="restart">是否重新播放</param> public void PlayBg(SoundType.UI bgName, bool restart = false, float volume = 1f) { Debug.Log("播放背景音效"); PlayBgBase(bgName, restart, volume); }