void OnTriggerEnter(Collider collider) { if (collider.tag == "Player" && !played) { tbeSource.Play(); played = true; } }
void OnTriggerEnter(Collider collider) { if (collider.tag == "Player") { tbeSource.Play(); if (tbeSource2) { StartCoroutine("LoopClips"); } } }
IEnumerator LoopClips() { while (true) { yield return(new WaitForSeconds(tbeSource.clip.length + 2)); tbeSource2.clip = myAudioClip[currentClip]; tbeSource2.Play(); yield return(new WaitForSeconds(tbeSource2.clip.length + 2)); currentClip++; if (currentClip >= myAudioClip.Length) { currentClip = 0; } } }