public void PlaySingleSFXWithRandomPitch(AudioClip clip, ESFXType type) { float randomPitch = Random.Range(minPitchSFXRange, maxPitchSFXRange); _randomPitchSources[_currentRandomSourceIndex].pitch = randomPitch; _randomPitchSources[_currentRandomSourceIndex].clip = clip; _randomPitchSources[_currentRandomSourceIndex].Play(); _currentRandomSourceIndex = (_currentRandomSourceIndex + 1) % RANDOM_PITCH_SOURCES_SIZE; }
public void PlaySingleSFX(AudioClip clip, ESFXType type) { //Resets the pitch AudioSource source = null; switch (type) { case ESFXType.ESFXType_PLAYER: source = _playerSFXAudioSource; break; case ESFXType.ESFXType_GAMEPLAY: source = _gameplaySFXAudioSource; break; } if (source) { source.pitch = 1.0f; source.PlayOneShot(clip); } }
public void PlayLoopSFX(ESFXType type) { refs.loopAudio.clip = clips[type]; refs.loopAudio.volume = volumes[type]; refs.loopAudio.Play( ); }
public void PlaySFX(ESFXType type) { refs.audio.PlayOneShot(clips[type], volumes[type]); }