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

// Man, this is a right palava! Does unity support Dictionary<> in the IDE? All I'll be doing here is a copy and paste... :(
// Agh, still ugly. Not doing functions for each anymore...

public class SFXManager : MonoBehaviour {

    public AudioClip m_bassChange;
    public AudioClip m_healItem;

    public AudioClip m_magicFlame;
    public AudioClip m_magicFrost;
    public AudioClip m_magicBolt;
    public AudioClip m_magicHeal;

    public AudioClip m_meleeHit;
    public AudioClip m_rangedHit;
    public AudioClip m_playerMove;
    public AudioClip m_enemyMove;
    
    public AudioClip m_menuSelect;
    public AudioClip m_death;
    public AudioClip m_death2;
    public AudioClip m_levelUp;
    public AudioClip m_winBattle;
    public AudioClip m_loseBattle;

    public AudioClip m_error;

    public static SFXManager ms_instance;
    public static SFXManager Instance
    {
        get { return ms_instance; }
    }

    public static void MenuSelect()
    {
        Play(Instance.m_menuSelect);
    }

    public static void PlayDeath()
    {
        if ( Random.Range(0, 2) == 0 )
        {
            Play(Instance.m_death);
        }
        else
        {
            Play(Instance.m_death2);
        }
    }

    public AudioSource m_audioSource;

    public static void Play(AudioClip clip)
    {
       // Debug.Log(Time.time + ":" + clip.name);
        Instance.m_audioSource.PlayOneShot(clip);
    }


	void Start () 
    {
        if (ms_instance != null)
        {
            Debug.LogError("Only one sfxman allowed");
        }
        ms_instance = this;
	}
}
