public static void PlayOneShot(TPAudioBundle bundle, string audioName, Action onAudioEnd, float volumeScale = 1.0f) { AudioClip clip = GetClip(bundle, audioName); SFXSource.PlayOneShot(clip, volumeScale); DelayAction(clip.length, onAudioEnd); }
public static void PlayOneShot(MonoBehaviour mono, TPAudioBundle bundle, string audioName, Action onAudioEnd, float volumeScale = 1.0f) { AudioClip clip = GetClip(bundle, audioName); SFXSource.PlayOneShot(clip, volumeScale); mono.StartCoroutine(DelayAction(clip.length, onAudioEnd)); }
public static void Play(TPAudioBundle bundle, string audioName, Sources source = Sources.SFX, ulong delay = 0) { AudioClip clip = GetClip(bundle, audioName); GetSource(source).clip = clip; GetSource(source).Play(delay); }
public static AudioSource SetClip(TPAudioBundle bundle, string audioName, Sources source = Sources.SFX) { AudioClip clip = GetClip(bundle, audioName); GetSource(source).clip = clip; return(SFXSource); }
public static void Play(TPAudioBundle bundle, string audioName, Sources source = Sources.Source, ulong delay = 0, Action onAudioEnd = null) { AudioClip clip = GetClip(bundle, audioName); GetSource().clip = clip; GetSource().Play(delay); DelayAction(clip.length + delay, onAudioEnd); }
public static void Play(MonoBehaviour mono, TPAudioBundle bundle, string audioName, Action onAudioEnd, Sources source = Sources.SFX, ulong delay = 0) { AudioClip clip = GetClip(bundle, audioName); GetSource(source).clip = clip; GetSource(source).Play(delay); mono.StartCoroutine(DelayAction(clip.length + delay, onAudioEnd)); }
public static AudioClip GetClip(TPAudioBundle bundle, string audioName) { int length = bundle.AudioObjects.Length; for (int i = 0; i < length; i++) { if (bundle.AudioObjects[i].Name == audioName) { return(bundle.AudioObjects[i].Clip); } } Debug.LogError("Audio clip named " + audioName + " in this bundle not found"); return(null); }
public static void RemoveFromPool(TPAudioBundle bundle) { audioPool.Remove(bundle.name); }
public static void AddToPool(TPAudioBundle bundle) { AddToPool(bundle.name, bundle); }
public static void AddToPool(string bundleName, TPAudioBundle bundle) { audioPool[bundleName] = bundle; }
public static void PlayOneShot(TPAudioBundle bundle, string audioName, float volumeScale = 1.0f) { SFXSource.PlayOneShot(GetClip(bundle, audioName), volumeScale); }