コード例 #1
0
ファイル: ContentView.cs プロジェクト: ylyking/GalaxyExplorer
        public void WillUnload()
        {
            AudioSource[] sources = GetComponentsInChildren <AudioSource>();

            foreach (AudioSource source in sources)
            {
                if (source.isPlaying)
                {
                    StartCoroutine(AudioHelper.FadeOutOverSeconds(source, ViewLoader.AudioFadeoutTime));
                }
            }
        }
コード例 #2
0
ファイル: VOManager.cs プロジェクト: ylyking/GalaxyExplorer
        public bool SetVOState(bool enabled)
        {
            VOEnabled = enabled;

            if (VOEnabled)
            {
                audioSource.volume = defaultVolume;
            }
            else
            {
                clipQueue.Clear();
                StartCoroutine(AudioHelper.FadeOutOverSeconds(audioSource, FadeOutTime));
            }

            return(VOEnabled);
        }
コード例 #3
0
ファイル: VOManager.cs プロジェクト: ylyking/GalaxyExplorer
        public void Stop(bool clearQueue = false)
        {
            if (clearQueue)
            {
                clipQueue.Clear();
            }

            nextClip = null;

            // Fade out the audio that's currently playing to stop it. Check here to
            // prevent coroutines from stacking up and calling Stop() on audioSource
            // at undesired times. Audio that would be faded out instead would just
            // be skipped over if the queue was cleared, which is what we want.
            if (!AudioHelper.FadingOut)
            {
                StartCoroutine(AudioHelper.FadeOutOverSeconds(audioSource, FadeOutTime));
            }
        }