public void PlayRandomIfNotPlaying(AudioClipListVar audioClipListVar) { if (this.CanPlay()) { this.PlayRandom(audioClipListVar); } }
public void PlayRandom(AudioClipListVar audioClipListVar) { if (this.gameObject.activeInHierarchy) { var randClip = audioClipListVar.AudioClipList.RandClip; this._audioSource.clip = randClip; this._audioSource.Play(); this._onClipBeganEvent.Invoke(); if (this._fireOnClipEndsEvent) { CancelInvoke("FireClipEndsEvent"); Invoke("FireClipEndsEvent", randClip.length); } } }