コード例 #1
0
        public static IEnumerator fadeOut(this GvrAudioSoundfield audioSource, float duration)
        {
            float startVolume = audioSource.volume;
            float counter     = 0f;

            while (counter < duration)
            {
                audioSource.volume = Mathf.Lerp(startVolume, 0, counter / duration);
                counter           += Time.deltaTime;
                yield return(new WaitForEndOfFrame());
            }
            audioSource.volume = 0;
            audioSource.Stop();
        }
コード例 #2
0
ファイル: GameController.cs プロジェクト: fjcx/PathwaysVR_v2
    private IEnumerator FadeOutAmbiAudio(GvrAudioSoundfield audioSoundField, float closeTimeSpreader)
    {
        float minMask  = 0.0f;
        float maxMask  = gvrTargetVolume;
        float currMask = audioSoundField.volume;

        while (currMask > minMask && cancelBlink == false)
        {
            audioSoundField.volume = Mathf.Lerp(minMask, maxMask, currMask);
            currMask -= closeTimeSpreader * Time.deltaTime;
            yield return(null);
        }

        audioSoundField.volume = minMask;
        audioSoundField.Stop();
    }