示例#1
0
 public void UpdateOcclusionLerp()
 {
     occluded = isActiveAndEnabled && !SightCheck.PlayerInSightLine(_targetTransform.position, 0);
     //occluded = isActiveAndEnabled && !SightCheck.PlayerInSightRay(_targetTransform.position, 0);
     //Debug.Log("Volume: " + _audioSource.volume);
     if (occluded)
     {
         _audioSource.volume = Mathf.Lerp(_audioSource.volume, occludedVolume, lerpModifier);
         if (affectReverb)
         {
             _audioSource.reverbZoneMix = Mathf.Lerp(_audioSource.reverbZoneMix, occludedReverb, lerpModifier);
         }
         if (affectLowPassFilter && _audioLPF != null)
         {
             _audioLPF.cutoffFrequency = Mathf.Lerp(_audioLPF.cutoffFrequency, occludedCutOff, lerpModifier);
         }
     }
     else
     {
         _audioSource.volume = Mathf.Lerp(_audioSource.volume, normalVolume, lerpModifier);;
         if (affectReverb)
         {
             _audioSource.reverbZoneMix = Mathf.Lerp(_audioSource.reverbZoneMix, normalReverb, lerpModifier);
         }
         if (affectLowPassFilter && _audioLPF != null)
         {
             _audioLPF.cutoffFrequency = Mathf.Lerp(_audioLPF.cutoffFrequency, normalCutOff, lerpModifier);
         }
     }
 }
示例#2
0
 public void UpdateOcclusion()
 {
     occluded = isActiveAndEnabled && !SightCheck.PlayerInSightRay(_targetTransform.position, 0);
     //Debug.Log("Volume: " + _audioSource.volume);
     //Debug.Log("Occluded: " + occluded);
     if (occluded)
     {
         _audioSource.volume = occludedVolume;
         if (affectReverb)
         {
             _audioSource.reverbZoneMix = occludedReverb;
         }
         if (affectLowPassFilter && _audioLPF != null)
         {
             _audioLPF.cutoffFrequency = occludedCutOff;
         }
     }
     else
     {
         _audioSource.volume = normalVolume;
         if (affectReverb)
         {
             _audioSource.reverbZoneMix = normalReverb;
         }
         if (affectLowPassFilter && _audioLPF != null)
         {
             _audioLPF.cutoffFrequency = normalCutOff;
         }
     }
 }