Beispiel #1
0
    public void PlayBGM(eBGMType eBGMType)
    {
        //if (!GameSetting.hasMusic)
        //{
        //    return;
        //}

        m_eCurBGM = eBGMType;

        string stName = m_stBGMPath[(int)m_eCurBGM];

        if (musicPlayer.clip == null || musicPlayer.clip.name != stName)
        {
            var clip = Global.ResourceMgr.CreateSoundResource("Sound/BGM/" + stName);
            musicPlayer.clip = clip.AudioClip;
            musicPlayer.Stop();
            musicPlayer.loop = true;
            musicPlayer.Play();
        }
        else
        {
            musicPlayer.loop = true;
            musicPlayer.Play();
        }
    }
Beispiel #2
0
    public void PlayBGMSound(eBGMType type, float vol = 0.7f, bool isloop = true)
    {
        _bgmPlayer.clip   = _bgmClips[(int)type];
        _bgmPlayer.volume = vol;
        _bgmPlayer.loop   = isloop;

        _bgmPlayer.Play();
    }
Beispiel #3
0
    public void PlayBGM(eBGMType eBGMType)
    {
        //if (!GameSetting.hasMusic)
        //{
        //    return;
        //}

        m_eCurBGM = eBGMType;

        string stName = m_stBGMPath[(int)m_eCurBGM];
        if (musicPlayer.clip == null || musicPlayer.clip.name != stName)
        {
            musicPlayer.clip = VResources.Load<AudioClip>("Sounds/" + stName);
            musicPlayer.Stop();
            musicPlayer.loop = true;
            musicPlayer.Play();
        }
        else
        {
            musicPlayer.loop = true;
            musicPlayer.Play();
        }
    }