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



public class MusicManager : MonoBehaviour {
    
    public List<AudioClip> environmentSounds = new List<AudioClip>();
    public List<Transform> sceneAudio = new List<Transform>();
    public AudioSource ass;

    public AudioSource music;

    public static MusicManager instance;


	// Use this for initialization
	void Start () {
        instance = this;

        PlayRandom();
	}

    void PlayRandom()
    {
        int r = Random.Range(0, environmentSounds.Count);
        float v = Random.Range(0.5f,1.0f);
        Play(environmentSounds[r], environmentSounds[r].length,  v);

    }

    void Play(AudioClip clip, float length, float v)
    {
        ass.clip = clip;
        ass.volume = v;
        ass.Play();

        Invoke("PlayRandom", length);

    }


	
	// Update is called once per frame
	void Update () {
		
	}
}
