using UnityEngine;
using System.Collections;

public class scrSoundManager : MonoBehaviour {

	public static scrSoundManager instance;

	public GameObject goPrefabSFX;

	GameObject[] goSFX = new GameObject[30];

	void Awake () {
	
		instance = this;

		for (int i = 0; i < goSFX.Length; i++ ) {

			goSFX[i] = Instantiate(goPrefabSFX) as GameObject;
			goSFX[i].GetComponent<AudioSource>().playOnAwake = true;
			goSFX[i].SetActive(false);

		}

	}
	
	public void doPlaySFX(AudioClip _clip) {

		for (int i = 0; i < goSFX.Length; i++ ) {

			if (!goSFX[i].activeSelf) {

				goSFX[i].GetComponent<AudioSource>().clip = _clip;
				goSFX[i].SetActive(true);
				break;

			}

		}

	}
}
