Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IEnumerator StartIdleSound(GameObject objectPosition)
- {
- while (isDead==false)
- {
- if (idleSounds.Length >= 1)
- {
- int index = Random.Range(0, idleSounds.Length);
- AudioClip chosenSound = idleSounds[index];
- yield return new WaitForSeconds(Random.Range(8, 40));
- AudioSource.PlayClipAtPoint(chosenSound, new Vector3(objectPosition.transform.position.x, objectPosition.transform.position.y, Camera.main.transform.position.z+5f), 1);
- }
- else
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement