Exemplo n.º 1
0
        public static void Update()
        {
            MusicSong songToPlay = currentSong;

            float fadeOutDuration = 0.3f;
            float fadeInDuration = 0.2f;

            if (Core.instance.currentPage is Engine) {
                songToPlay = MENU;
            } else {
                /*if (Arena.instance != null) {
                    if (Arena.instance.dayManager.isDay) {
                        songToPlay = DAYTIME;
                    } else {
                        songToPlay = NIGHTTIME;
                    }
                }*/

            }

            if (!Config.SHOULD_PLAY_MUSIC) {
                songToPlay = null;
            }

            if (songToPlay != currentSong) {
                manager.fadeOutDuration = fadeOutDuration;
                manager.fadeInDuration = fadeInDuration;
                manager.PlaySong (songToPlay);
                currentSong = songToPlay;
            }
        }
Exemplo n.º 2
0
        void PlayNextSong()
        {
            currentSong = nextSong;
            nextSong = null;

            AudioClip clip = LoadAudioClip (currentSong.resourcePath);

            if (clip != null) {
                audioSource.clip = clip;
                audioSource.volume = 0;
                Go.killAllTweensWithTarget (audioSource);
                Go.to (audioSource, fadeInDuration, new GoTweenConfig ().floatProp ("volume", currentSong.volume));
                audioSource.loop = true;

                if (_isPaused) {
                    songPauseTime = audioSource.time = currentSong.playTime;
                    audioSource.Stop ();
                } else {
                    songPauseTime = audioSource.time = currentSong.playTime;
                    audioSource.Play ();
                }
            } else {
                audioSource.clip = null;//don't play anything
                audioSource.Stop ();
                currentSong = null;
            }
        }
Exemplo n.º 3
0
        public void PlaySong(MusicSong song)
        {
            nextSong = song;

            FadeOutCurrentSong ();
        }