public void PlaySFX(SoundClipId id, float volume = 1.0f, float pitch = 1.0f, float delay = 0) { // Get url based on key string url = GetSoundClip(id); StartCoroutine(CoroutinePlaySFX(url, volume, pitch, delay)); }
public void PlaySoundWithCallback(SoundClipId clipId, AudioCallback callback) { PlayBGSoundClip(clipId); if (audioCallBackCoroutine != null) { StopCoroutine(audioCallBackCoroutine); } audioCallBackCoroutine = StartCoroutine(DelayedCallback(bgm.clip.length, callback)); }
string GetSoundClip(SoundClipId id) { string url; if (clips.ContainsKey(id)) { url = clips[id]; } else { Debug.LogError("Sound not found id= " + id); url = clips[SoundClipId.ERROR]; } return(url); }
//static GameObject this; public void PlayBGSoundClip(SoundClipId id, float volume = 1.0f, bool loop = true, float startTime = 0) { string url = GetSoundClip(id); PlayBG(url, volume, loop, startTime); }
public void PlaySFXIfOnScreen(SoundClipId id, GameObject go, float volume = 1.0f, float pitch = 1.0f, float delay = 0) { // Re-write? }