Exemplo n.º 1
0
    private void switchMusicClips(formMusicData newMusicData, bool init)
    {
        if (!init)
        {
            if (newMusicData.normalMusic == normalBGM.clip &&
                newMusicData.upsetMusic == upsetBGM.clip)
            {
                return;
            }

            // fade out instead?
            normalBGM.Stop();
            upsetBGM.Stop();
            fading = false;
        }

        normalBGM.clip = newMusicData.normalMusic;
        upsetBGM.clip  = newMusicData.upsetMusic;
        twoSongs       = newMusicData.hasTwoTracks;

        if (!twoSongs || onNormalSong)
        {
            normalBGM.volume = 1;
            upsetBGM.volume  = 0;
            normalBGM.PlayDelayed(1);
            songFreeze = NORMAL_FREEZE;
        }
        else
        {
            normalBGM.volume = 0;
            upsetBGM.volume  = 1;
            upsetBGM.PlayDelayed(1);
            songFreeze = UPSET_FREEZE;
        }
    }
Exemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        twoSongs              = false;
        onNormalSong          = true;
        songFreeze            = 0;
        fading                = false;
        currentMusicDataIndex = 0;

        formMusicData startingData = petFormMusicData[0];

        switchMusicClips(startingData, true);
    }