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

public class AudioController : MonoBehaviour {

	public static AudioController AC;

	public AudioClip[] sfxDict;
	public AudioClip[] musicDict;

	public AudioSource sfx;
	public AudioSource msc;

	// Use this for initialization
	void Awake () {
		AC = this;
		sfx = gameObject.GetComponent<AudioSource> ();
		msc = gameObject.GetComponent<AudioSource> ();

		sfx.loop = false;
		sfx.playOnAwake = false;

		msc.loop = true;
	}
	
	// Update is called once per frame
	void Update () {
		
	}


	// Sfx tracks
	public void playCloud() {
		sfx.PlayOneShot (sfxDict[0]);
	}

	public void playDeath() {
		sfx.PlayOneShot (sfxDict[1]);
	}

	public void playExp() {
		sfx.PlayOneShot (sfxDict[2]);
	}

	public void playMail() {
		sfx.PlayOneShot (sfxDict[3]);
	}

	public void playMsg() {
		sfx.PlayOneShot (sfxDict[4]);
	}

	public void playPunch() {
		sfx.PlayOneShot (sfxDict[5],0.2f);
	}

	public void playPhone() {
		sfx.PlayOneShot (sfxDict[6]);
	}


	// Music Tracks
	public void playMenu() {
		msc.clip = musicDict[0];
		msc.Play ();
	}

	public void playTheme() {
		msc.Stop ();
		msc.clip = musicDict [1];
		msc.Play ();
	}

	public void playVictor() {
		msc.Stop ();
		msc.loop = false;
		msc.clip = musicDict [2];
		msc.Play();
	}

}
