using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class SoundManager : MonoBehaviour {

    private static SoundManager instance;

    [SerializeField]
    List<Transform> Sounds = new List<Transform>();



    public static SoundManager Instance
    {
        get
        {
            return instance;
        }
    }

    void Awake()
    {
        instance = this;

        foreach(Transform g in transform)
        {
            Sounds.Add(g);
            print(g);
        }
    }   
     
    public void PlaySound(int sound)
    {
        foreach (Transform g in Sounds)
        {
            g.GetComponent<AudioSource>().Stop();
        }

        Sounds[sound].GetComponent<AudioSource>().Play();
    }
}
