/// <summary> /// BGMを流す /// </summary> /// <param name="bgm">どのBGMを流すか</param> /// <param name="is_loop">ループさせるか</param> /// <param name="volume">ボリューム</param> public void Play(BgmEnum bgm, bool is_loop = true, float volume = 1.0f) { SetVolume(volume); aud.loop = is_loop; if (currentBgm != bgm) { Stop(); currentBgm = bgm; } switch (bgm) { case BgmEnum.NONE: aud.clip = null; break; } if (aud.clip) { aud.Play(); } }
/// <summary> /// BGMを流す /// </summary> /// <param name="bgm">どのBGMを流すか</param> /// <param name="is_loop">ループさせるか</param> /// <param name="volume">ボリューム</param> public void Play(BgmEnum bgm, bool is_loop = true, float volume = 1.0f) { SetVolume(volume); aud.loop = is_loop; if (currentBgm != bgm) { Stop(); currentBgm = bgm; } switch (bgm) { case BgmEnum.Title: aud.clip = title; break; case BgmEnum.Select: aud.clip = select; break; case BgmEnum.Game: aud.clip = game; break; case BgmEnum.Result: aud.clip = result; break; case BgmEnum.None: aud.clip = null; break; } if (aud.clip) { aud.Play(); } }
/// <summary> /// BGMを止める /// </summary> public void Stop() { aud.Stop(); currentBgm = BgmEnum.None; }