Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        public static AudioSource SetClip(TPAudioBundle bundle, string audioName, Sources source = Sources.SFX)
        {
            AudioClip clip = GetClip(bundle, audioName);

            GetSource(source).clip = clip;
            return(SFXSource);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
 public static void RemoveFromPool(TPAudioBundle bundle)
 {
     audioPool.Remove(bundle.name);
 }
Exemplo n.º 9
0
 public static void AddToPool(TPAudioBundle bundle)
 {
     AddToPool(bundle.name, bundle);
 }
Exemplo n.º 10
0
 public static void AddToPool(string bundleName, TPAudioBundle bundle)
 {
     audioPool[bundleName] = bundle;
 }
Exemplo n.º 11
0
 public static void PlayOneShot(TPAudioBundle bundle, string audioName, float volumeScale = 1.0f)
 {
     SFXSource.PlayOneShot(GetClip(bundle, audioName), volumeScale);
 }