Esempio n. 1
0
 private void Awake()
 {
     if (!Instance)
     {
         Instance = this;
     }
 }
Esempio n. 2
0
 public void StopAudio(InGameSound sound)
 {
     if (_currentSound == null || _currentSound != sound)
     {
         return;
     }
     _audioSource.Stop();
     _audioSource.clip = null;
     _currentSound     = null;
 }
Esempio n. 3
0
 public void PlayAudio(InGameSound sound)
 {
     if (_currentSound != null && (_currentSound == sound || _currentSound.Priority > sound.Priority))
     {
         return;
     }
     _currentSound       = sound;
     _audioSource.clip   = _currentSound.AudioClip;
     _audioSource.loop   = _currentSound.Loop;
     _audioSource.pitch  = _currentSound.Pitch;
     _audioSource.volume = _currentSound.Volume;
     _audioSource.Play();
 }