Esempio n. 1
0
        public static void PlayCustomMusic(AudioClip newMusic)
        {
            //set up the other music source
            var source = Sounds._musicSources[1 - Sounds._musicHead];

            source.clip = newMusic;
            source.loop = true;


            if (Sounds.crossMixMusic)
            {
                source.volume = 0;
                source.Play();
                Sounds.CrossMix(Sounds.crossMixDuration);
            }
            else
            {
                if (Sounds._musicSource.isPlaying)
                {
                    Sounds._musicSource.Stop();
                }

                source.volume     = Sounds.masterVolume * Sounds.musicVolume;
                Sounds._musicHead = 1 - Sounds._musicHead;
                Sounds._musicSource.Play();
            }
        }