예제 #1
0
        void Update()
        {
            //以下、ダッキング処理
            if (Mathf.Approximately(1.0f, SoundManager.DuckVolume))
            {
                //ダッキングのボリュームが1なので常に影響受けない
                DuckVolume = 1;
                return;
            }

            //ダッキングの影響をうけるグループがない
            if (DuckGroups.Count <= 0)
            {
                DuckVolume = 1;
                return;
            }

            bool  isPlaying = DuckGroups.Exists(x => x.IsPlaying());
            float dukkingTo = (isPlaying) ? SoundManager.DuckVolume : 1;

            if (Mathf.Abs(dukkingTo - DuckVolume) < 0.001f)
            {
                //ダッキングの目標値に近づいた
                DuckVolume   = dukkingTo;
                duckVelocity = 0;
            }
            else
            {
                DuckVolume = Mathf.SmoothDamp(DuckVolume, dukkingTo, ref duckVelocity, SoundManager.DuckFadeTime);
            }
        }
예제 #2
0
        void UpdateDucking()
        {
            //以下、ダッキング処理
            if (Mathf.Approximately(1.0f, SoundManager.DuckVolume))
            {
                //ダッキングのボリュームが1なので常に影響受けない
                DuckVolume = 1;
                return;
            }

            //ダッキングの影響をうけるグループがない
            if (DuckGroups.Count <= 0)
            {
                DuckVolume = 1;
                return;
            }
            bool  isPlaying = DuckGroups.Exists(x => x.IsPlaying());
            float dukkingTo = (isPlaying) ? SoundManager.DuckVolume : 1;

            DuckVolume = UpdateFade(DuckVolume, dukkingTo, SoundManager.DuckFadeTime, ref duckVelocity);
        }