Пример #1
0
    private void PlayChill()
    {
        if (_mood == Mood.Chill)
        {
            return;
        }

        _mood = Mood.Chill;
        player.PlaySelectedMusic(chillMusic);
    }
Пример #2
0
    public void PlayLevelMusic()
    {
        //This switch looks at the last loadedLevel number using the scene index in build settings to decide which music clip to play.
        switch (SceneManager.GetActiveScene().buildIndex)
        {
        //If scene index is 0 (usually title scene) assign the clip titleMusic to musicSource
        case 1:
            musicPlayer.PlaySelectedMusic(menuSettings.mainMenuMusicLoop);
            break;

        //If scene index is 1 (usually main scene) assign the clip mainMusic to musicSource
        case 2:
            musicPlayer.PlaySelectedMusic(menuSettings.musicLoopToChangeTo);
            break;

        case 3:
            musicPlayer.PlaySelectedMusic(menuSettings.musicForCreditsAndVictory);
            break;
        }

        //Fade up the volume very quickly, over resetTime seconds (.01 by default)
        FadeUp(resetTime);
        //Play the assigned music clip in musicSource
    }