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

public class SoundManager : MonoBehaviour
{


    Dictionary<string, AudioClip> soundList = new Dictionary<string, AudioClip>();
    Dictionary<string, AudioClip> musicList = new Dictionary<string, AudioClip>();

    public AudioSource soundPlayer;
    public AudioSource musicPlayer;

    // Start is called before the first frame update
    void Start()
    {
        soundList["bubble1"] = Resources.Load<AudioClip>("Sound/吞珍珠1");
        soundList["bubble2"] = Resources.Load<AudioClip>("Sound/吞珍珠2");
        soundList["show up"] = Resources.Load<AudioClip>("Sound/彩色珍珠出现");
        soundList["suck1"] = Resources.Load<AudioClip>("Sound/suck1");
        soundList["suck2"] = Resources.Load<AudioClip>("Sound/suck2");
        soundList["stir"] = Resources.Load<AudioClip>("Sound/搅动音");
        soundList["star 0"] = Resources.Load<AudioClip>("Sound/0颗星音效");
        soundList["star 1"] = Resources.Load<AudioClip>("Sound/1颗星音效");
        soundList["star 2"] = Resources.Load<AudioClip>("Sound/2颗星音效");
        soundList["star 3"] = Resources.Load<AudioClip>("Sound/3颗星音效");
        soundList["click 1"] = Resources.Load<AudioClip>("Sound/点击音效1");
        soundList["click 2"] = Resources.Load<AudioClip>("Sound/翻页音效");
        soundList["start"] = Resources.Load<AudioClip>("Sound/开始音效");
        soundList["charge"] = Resources.Load<AudioClip>("Sound/蓄力音");
        soundList["timer"] = Resources.Load<AudioClip>("Sound/倒计时");

        musicPlayer.Play();
    }

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

    public void PlaySound(string name)
    {
        soundPlayer.clip = soundList[name];
        soundPlayer.Play();
    }
}
