Exemplo n.º 1
0
        /// <summary>
        /// Play a given AudioSource. Does not need to be in the audioSources list.
        /// Will always be run on active instance, so it is safe to use in UnityEvents even if inactive.
        /// </summary>
        public void Play(AudioSource source)
        {
            if (inst != this)
            {
                inst.Play(source);
                return;
            }

            if (isPlaying)
            {
                Stop();
            }

            isPlaying     = true;
            currentSource = source;

            if (fadeIn)
            {
                source.FadeIn();
            }
            else
            {
                source.ClearFade();
                source.Play();
                started = true;
            }
        }