Beispiel #1
0
 public SoundHandler Play(AudioClipWithVolume clip, bool loop = false, float pitch = 1f,
                          bool ignoreListenerPause            = false, float delay = 0f)
 {
     if (clip == null)
     {
         return(null);
     }
     return(Play(clip.Clip, clip.VolumeModifier, loop, clip.Pitch * pitch, ignoreListenerPause, delay));
 }
Beispiel #2
0
        public static void PlayClip(this AudioSource audioSource, AudioClipWithVolume clip, float additionalModifier = 1f)
        {
            if (clip == null || clip.Clip == null || clip.VolumeModifier < 1e-4)
            {
                return;
            }

            if (audioSource == null)
            {
                return;
            }

            audioSource.PlayOneShot(clip.Clip, clip.VolumeModifier * additionalModifier);
        }