private void Awake() { if (!Instance) { Instance = this; } }
public void StopAudio(InGameSound sound) { if (_currentSound == null || _currentSound != sound) { return; } _audioSource.Stop(); _audioSource.clip = null; _currentSound = null; }
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(); }