Example #1
0
    public void PlayBgm(string bgmName)
    {
        var bgm            = ResourceFacade.LoadAudioClip(bgmName);
        var bgmAudioSource = _bgmPlayer.GetComponent <AudioSource>();

        bgmAudioSource.clip = bgm;
        bgmAudioSource.loop = true;
        bgmAudioSource.Play();
    }
Example #2
0
    public async void PlaySfx(string sfxName)
    {
        var sfx            = ResourceFacade.LoadAudioClip(sfxName);
        var sfxAudioSource = _sfxPlayer.AddComponent <AudioSource>();

        sfxAudioSource.clip = sfx;
        sfxAudioSource.Play();

        await PlaySfxDelay(sfxAudioSource, sfxAudioSource.clip.length);
    }