/// <summary> /// Plays a single audio clip from a given reaction audio with its included parameters /// </summary> /// <param name="reactionAudio"></param> private IEnumerator SingleAudioPlay(ReactionAudio reactionAudio) { yield return(new WaitForSeconds(reactionAudio.audioDelay)); if (reactionAudio.audioClip) { GameVars.instance.audioManager.PlaySFX(reactionAudio.audioClip, reactionAudio.volume, transform.position); } else { Debug.Log("[WARNING] No audioclip found for this reactionaudio"); } }
private void PlayAmbientAudio(ReactionAudio chosenClip) { audioSource.Stop(); if (chosenClip.doLoop) { audioSource.loop = true; } else { audioSource.loop = false; } float totalVolume = chosenClip.volume * GameVars.instance.musicVolumeScale; audioSource.volume = 0; audioSource.pitch = chosenClip.pitch; audioSource.priority = chosenClip.priority; audioSource.clip = chosenClip.audioClip; audioSource.Play(); isStarting = false; hasPlayed = true; StartCoroutine(FadeInAudioTrack(audioSource, totalVolume, 8.0f)); }