Esempio n. 1
0
    void Update()
    {
        // シーンチェンジをチェック
        if (sceneName != SceneManager.GetActiveScene().name)
        {
            sceneName = SceneManager.GetActiveScene().name;

            // ボリューム設定
            fm.SetVolume("BGM", SaveData.SoundBGMVolume);
            fm.SetVolume("SE", SaveData.SoundSEVolume);

            // BGM再生
            if (sceneName == "Menu_Logo")
            {
                BGM_LOGO.Play();
            }
            else
            if (sceneName == "Menu_Title")
            {
                if (!BGM_TITLE.isPlaying)
                {
                    fm.Stop("BGM");
                    BGM_TITLE.Play();
                    fm.FadeInVolume(BGM_TITLE, SaveData.SoundBGMVolume, 1.0f, true);
                }
            }
            else
            if (sceneName == "Menu_Option" ||
                sceneName == "Menu_HiScore" ||
                sceneName == "Menu_Option")
            {
            }
            else
            if (sceneName == "StageA")
            {
                //fm.Stop ("BGM");
                fm.FadeOutVolumeGroup("BGM", BGM_STAGEA, 0.0f, 1.0f, false);
                fm.FadeInVolume(BGM_TITLE, SaveData.SoundBGMVolume, 1.0f, true);
                BGM_STAGEA.loop = true;
                BGM_STAGEA.Play();
            }
            else
            if (sceneName == "StageB_Room")
            {
                fm.Stop("BGM");
                BGM_STAGEB_ROOMSAKURA.loop = true;
                BGM_STAGEB_ROOMSAKURA.Play();
            }
            else
            if (sceneName == "StageB_Room_A" ||
                sceneName == "StageB_Room_B" ||
                sceneName == "StageB_Room_C")
            {
                fm.Stop("BGM");
                BGM_BOSSA.loop = true;
                BGM_BOSSA.Play();
            }
            else
            if (sceneName == "StageB_Boss")
            {
                fm.Stop("BGM");
                BGM_BOSSB.loop = true;
                BGM_BOSSB.Play();
            }
            else
            if (sceneName == "StageZ_Ending")
            {
                fm.Stop("BGM");
                BGM_ENDING.Play();
            }
            else
            {
                if (!BGM_STAGEB.isPlaying)
                {
                    fm.Stop("BGM");
                    BGM_STAGEB.loop = true;
                    BGM_STAGEB.Play();
                }
            }
        }
    }
Esempio n. 2
0
    void Update()
    {
        // シーンチェンジをチェック
        if (sceneName != Application.loadedLevelName)
        {
            sceneName = Application.loadedLevelName;

            // BGM再生
            if (sceneName == "Menu_Logo")
            {
                BGM_LOGO.Play();
            }
            else
            if (sceneName == "Menu_Title")
            {
                if (!BGM_TITLE.isPlaying)
                {
                    fm.Stop("BGM");
                    BGM_TITLE.Play();
                    fm.FadeInVolume(BGM_TITLE, 1.0f, 1.0f, true);
                }
            }
            else
            if (sceneName == "Menu_Option" ||
                sceneName == "Menu_HiScore" ||
                sceneName == "Menu_Option")
            {
            }
            else
            if (sceneName == "StageA")
            {
                //fm.Stop ("BGM");
                fm.FadeOutVolumeGroup("BGM", BGM_STAGEA, 0.0f, 1.0f, false);
                fm.FadeInVolume(BGM_TITLE, 1.0f, 1.0f, true);
                BGM_STAGEA.loop = true;
                BGM_STAGEA.Play();
            }
            else
            if (sceneName == "StageB_Room")
            {
                fm.Stop("BGM");
                BGM_STAGEB_ROOMSAKURA.loop = true;
                BGM_STAGEB_ROOMSAKURA.Play();
            }
            else
            if (sceneName == "StageB_Room_A" ||
                sceneName == "StageB_Room_B" ||
                sceneName == "StageB_Room_C")
            {
                fm.Stop("BGM");
                BGM_BOSSA.loop = true;
                BGM_BOSSA.Play();
            }
            else
            if (sceneName == "StageB_Boss")
            {
                fm.Stop("BGM");
                BGM_BOSSB.loop = true;
                BGM_BOSSB.Play();
            }
            else
            if (sceneName == "StageZ_Ending")
            {
                fm.Stop("BGM");
                BGM_ENDING.Play();
            }
            else
            {
                if (!BGM_STAGEB.isPlaying)
                {
                    fm.Stop("BGM");
                    BGM_STAGEB.loop = true;
                    BGM_STAGEB.Play();
                }
            }
        }
    }
Esempio n. 3
0
    void Update()
    {
        // 씬이 바뀌었는지 검사
        currSceneName = SceneManager.GetActiveScene();

        if (sceneName != currSceneName.name)
        {
            sceneName = currSceneName.name;

            //음량 설정
            fm.SetVolume("BGM", SaveData.SoundBGMVolume);
            fm.SetVolume("SE", SaveData.SoundSEVolume);

            // BGM 재생
            if (sceneName == "0_Title_Scene")
            {
                BGM_LOGO.Play();
            }
            else
            if (sceneName == "2_Main_Scene")
            {
                //if (!BGM_MAIN.isPlaying)
                //{
                //    fm.Stop("BGM");
                //    BGM_MAIN.Play();
                //    fm.FadeInVolume(BGM_MAIN, 1.0f, 1.0f, true);
                //}
                BGM_MAIN.Play();
                fm.FadeInVolume(BGM_MAIN, .3f, 0.2f, true);
            }
            else
            if (sceneName == "3_Game_Scene")
            {
                fm.Stop("BGM");
                fm.FadeOutVolumeGroup("BGM", BGM_STAGEA, 0.0f, 1.0f, false);
                fm.FadeInVolume(BGM_TITLE, 1.0f, 1.0f, true);
                BGM_STAGEA.loop = true;
                BGM_STAGEA.Play();
            }
            // else
            // if (sceneName == "DungeonA")
            // {
            //     fm.Stop("BGM");
            //     //fm.FadeOutVolumeGroup("BGM",BGM_DungeonA,0.0f,1.0f,false);
            //     fm.FadeInVolume(BGM_TITLE, 1.0f, 1.0f, true);
            //     //BGM_DungeonA.loop = true;
            //     //BGM_DungeonA.Play();
            // }

            //else
            //if (sceneName == "StageB_Room_A" ||
            //         sceneName == "StageB_Room_B" ||
            //        sceneName == "StageB_Room_C")
            //     {
            //     fm.Stop("BGM");
            //     BGM_BOSSA.loop = true;
            //     BGM_BOSSA.Play();
            // }
            else
            {
                //if (!BGM_STAGEB.isPlaying)
                //{
                //    fm.Stop("BGM");
                //    BGM_STAGEB.loop = true;
                //    BGM_STAGEB.Play();
                //}
            }
        }
    }