using UnityEngine;
using System.Collections;

public class AudioManager : MonoBehaviour 
{
	public static AudioManager audioManager;
	
	public AudioSource punchAudio;
	public AudioClip [] punchSounds;

	public AudioSource kickAudio;
	public AudioClip [] kickSounds;

	public AudioSource animalAudio;
	public AudioClip [] animalSounds;

	public enum Announcements
	{
		ThreeTwoOne,
		Fight,
		Anihilated,
		Defeated,
		Knockout,
		KO,
		TitleKickPunch,
		Player1Win,
		Player2Win,
		Player3Win,
		Player4Win,
		PlayerOneJoin,
		PlayerTwoJoin,
		PlayerThreeJoin,
		PlayerFourJoin,
		TheClap
	};

	public AudioSource announcerAudio;
	public AudioClip [] announcementSounds;

	public AudioSource hitAudio;
	public AudioClip [] hitSounds;

	void Awake () 
	{
		AudioManager.audioManager = this;
	}

	void Update ()
	{
	}

	public void PlayPunch()
	{
		int randomSound = Random.Range(0, punchSounds.Length);
		punchAudio.clip = punchSounds[randomSound];
		punchAudio.PlayOneShot(punchSounds[randomSound]);
	}

	public void PlayKick()
	{
		int randomSound = Random.Range(0, kickSounds.Length);
		kickAudio.clip = kickSounds[randomSound];
		kickAudio.PlayOneShot(kickSounds[randomSound]);
	}

	public void PlayAnimal()
	{
		int randomSound = Random.Range(0, animalSounds.Length);
		animalAudio.clip = animalSounds[randomSound];
		animalAudio.PlayOneShot(animalSounds[randomSound]);
	}

	public void PlayHit()
	{
		int randomSound = Random.Range(0, hitSounds.Length);
		hitAudio.clip = hitSounds[randomSound];
		hitAudio.PlayOneShot(hitSounds[randomSound]);
	}

	public void PlayAnnoucements(Announcements announcerID)
	{
		int soundID = (int)announcerID;
		announcerAudio.clip = announcementSounds[soundID];
		announcerAudio.PlayOneShot(announcementSounds[soundID]);
	}
}
