public void Play(CustomAudioClip customAudioClip, ulong delayInSeconds = 0L) { _customAudioClip = customAudioClip; _audioSource.clip = customAudioClip.GetClip(); _audioSource.loop = customAudioClip.IsMusic; _audioSource.volume = customAudioClip.GetVolume(); _audioSource.pitch = customAudioClip.GetPitch(); if (customAudioClip.name == "clear-throat" || customAudioClip.name == "countdown-three") { return; } _audioSource.PlayDelayed(delayInSeconds); if (!customAudioClip.IsMusic) { StartCoroutine(ReturnToPoolDelayed(delayInSeconds + customAudioClip.GetClip().length + _destroyDelay)); } }
private void Update() { if (_isMuted) { _audioSource.volume = 0; return; } if (_customAudioClip == null) { return; } if (_isFading) { return; } _audioSource.pitch = _customAudioClip.GetPitch() * AudioSettings.Instance.BasePitch; _audioSource.volume = _customAudioClip.GetVolume() * AudioSettings.Instance.BaseVolume; }