public void PlaySong(int indexToPlay) { audioInterface.SetClip(playlist[indexToPlay]); StartCoroutine(WaitForSongEnd(audioInterface.GetClip().length)); audioInterface.Play(); playingIndex = indexToPlay; }
public void Play() { if (played == false) { audioInterface.Play(); if (!dontCountAsPlayedUntilClipFinishes) { played = true; } else { StartCoroutine(WaitForEndToSetPlayed(audioInterface.GetClip())); } } }
void OnCollisionEnter(Collision col) { float newVolume = Mathf.Clamp01(col.relativeVelocity.magnitude * collisionVolume); audioInterface.SetVolume(newVolume); audioInterface.SetClip(sourceClips[Random.Range(0, sourceClips.Length - 1)]); if (ignoreGroupForCollisions) { audioInterface.ForcePlay(); } else { audioInterface.Play(); } }