示例#1
0
 public static void Play(this AudioSource source, AudioClipInfo info)
 {
     source.volume = info.volume;
     source.pitch  = info.pitch;
     source.loop   = info.loop;
     source.clip   = info.audioClip;
     source.Play();
 }
示例#2
0
        /// <summary>
        /// Plays an audio clip, only use this for the UI, it is not pooled so performance isn't superb.
        /// </summary>
        public static void AudioPlayOneShot(AudioClipInfo clip)
        {
            if (clip == null || clip.audioClip == null)
            {
                return;
            }

            if (instance == null)
            {
                DevdogLogger.LogWarning("AudioManager not found, yet trying to play an audio clip....");
            }

            if (_audioQueue.Any(o => o.audioClip == clip.audioClip) == false)
            {
                _audioQueue.Enqueue(clip);
            }
        }