This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
public-speaking-vr/Assets/Scripts/SoundManager.cs
2016-11-19 13:14:49 -06:00

32 lines
593 B
C#

using UnityEngine;
using System.Collections;
public class SoundManager : MonoBehaviour {
public AudioClip[] clips;
AudioSource audio;
// Use this for initialization
void Start () {
audio = gameObject.GetComponent<AudioSource>();
StartCoroutine("Wait");
}
// Update is called once per frame
void Update () {
}
IEnumerator Wait()
{
yield return new WaitForSeconds(17);
int rand = Random.Range(0, 4);
//print(rand);
audio.clip = clips[rand];
audio.Play();
StartCoroutine("Wait");
}
}