Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. IEnumerator StartIdleSound(GameObject objectPosition)
  2. {
  3. while (isDead==false)
  4. {
  5. if (idleSounds.Length >= 1)
  6. {
  7. int index = Random.Range(0, idleSounds.Length);
  8. AudioClip chosenSound = idleSounds[index];
  9. yield return new WaitForSeconds(Random.Range(8, 40));
  10. AudioSource.PlayClipAtPoint(chosenSound, new Vector3(objectPosition.transform.position.x, objectPosition.transform.position.y, Camera.main.transform.position.z+5f), 1);
  11. }
  12. else
  13. break;
  14. }
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement