Esempio n. 1
0
        private void AddAudioSource()
        {
            GameObject go = Instantiate(BaseAudioSettings);
            go.transform.parent = transform;

            BGAudioSource next = new BGAudioSource(this, go.GetComponent<AudioSource>());

            _audioSourcePool.Add(next);
        }
Esempio n. 2
0
    public void ClaimAudioSource(float fadeTime)
    {
        if (!HasAudioSource())
        {
            _audioSource = AudioSystem.GetAudioSource(GetHashCode());
        }

        _audioSource.SetAudioSettings(AudioSettings);
        _audioSource.Volume = Volume;
        _audioSource.FadeIn(fadeTime);
    }
Esempio n. 3
0
 public void Stop(float fadeTime)
 {
     if (HasAudioSource())
     {
         _audioSource.FadeOut(fadeTime);
         _audioSource = null;
     }
 }
Esempio n. 4
0
 public void Stop()
 {
     if (HasAudioSource())
     {
         _audioSource.Return();
         _audioSource = null;
     }
 }
Esempio n. 5
0
 public void ReturnAudioSource(BGAudioSource source)
 {
     _inUse.Remove(source);
     _audioSourcePool.Add(source);
 }