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

public class AudioManager : MonoBehaviour {

    public AudioSource radioSounds;
    public AudioSource noiseSource;

    public AudioClip noiseSFX;

    public List<AudioClip> hits;
    public List<AudioClip> misses;

    public List<AudioClip> screams;

    public List<AudioClip> moveWest;
    public List<AudioClip> moveEast;
    public List<AudioClip> moveNorth;
    public List<AudioClip> moveSouth;


    public float lowPitchRange = .9f;
    public float highPitchRange = 1.1f;

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}

    public void PlaySingle(AudioClip clip)
    {
        radioSounds.clip = clip;
        radioSounds.Play();
    }

    public void PlayNoise(AudioClip clip)
    {
        noiseSource.clip = clip;
        float randomPitch = Random.Range(lowPitchRange, highPitchRange);
        noiseSource.pitch = randomPitch;
        noiseSource.Play();
    }
    public void StopNoise()
    {
        noiseSource.Stop();
    }

    public void RandomizeSFX (List<AudioClip> clips)
    {
        int randomIndex = Random.Range(0, clips.Count);
        float randomPitch = Random.Range(lowPitchRange, highPitchRange);

        radioSounds.pitch = randomPitch;
        radioSounds.clip = clips[randomIndex];
        radioSounds.Play();
    }

}
