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

public class AudioManager : MonoBaseMgr<AudioManager>
{
    private GameObject PlayMusic;
    private AudioSource mAudiSource;
    private void Awake()
    {
        mAudiSource = PlayMusic.AddComponent<AudioSource>();
    }

    public void PlayAudio(string MusicUrl)
    {
        StartCoroutine(LoadAudio(MusicUrl));
    }
    private IEnumerator LoadAudio(string MusicUrl)
    {
        // www 加载音频
        WWW www = new WWW(MusicUrl);
        yield return www;
        var clipTemp = www.GetAudioClip();
        mAudiSource.clip = clipTemp;

        //播放音频
        mAudiSource.Play();
    }
    private void Update()
    {
        //Debug.unityLogger.Log("是否暂停"+ mAudiSource.isPlaying);
    }
    public void StopPlay()
    {

    }
}
