Beispiel #1
0
        public void Play(string audioKey)
        {
            var audioClip = _audioStorage.GetAudioClip(audioKey);

            if (audioClip != null)
            {
                var audioSource = _audioSourcePool.GetNext();
                audioSource.clip = audioClip;
                audioSource.Play();
                this.WaitUntil(() => !audioSource.isPlaying, () => _audioSourcePool.Return(audioSource));
            }
        }
Beispiel #2
0
        public void Play(string audioKey)
        {
            var audioClip = _audioStorage.GetAudioClip(audioKey);

            if (audioClip != null)
            {
                var audioSource = _audioSourcePool.GetNext();
                audioSource.clip = audioClip;
                audioSource.Play();

                _activeAudioSources.Add(audioSource);
            }
        }
Beispiel #3
0
        public void Play(string audioKey)
        {
            var audioClip = _audioStorage.GetAudioClip(audioKey);

            if (audioClip != null)
            {
                if (_checkCapacity)
                {
                    var activeAudio = _activeAudioSources.FindAll(s => s.clip == audioClip);
                    if (activeAudio.Count >= _audioStorage.GetCapacity(audioKey))
                    {
                        return;
                    }
                }

                var audioSource = _audioSourcePool.GetNext();
                audioSource.clip = audioClip;
                audioSource.Play();

                _activeAudioSources.Add(audioSource);
            }
        }