예제 #1
0
 protected override void ApplyValue(float value)
 {
     if (sound != null)
     {
         if (showDebug)
         {
             Debug.Log(base.name + " Sound Lerp ");
         }
         float num = Mathf.Lerp(AudioUtils.DBToValue(from), AudioUtils.DBToValue(to), value);
         sound.SetVolume(num);
         if (showDebug)
         {
             Debug.Log(base.name + " Current Volume = " + num);
         }
     }
     else if (unitySound != null)
     {
         if (showDebug)
         {
             Debug.Log(base.name + " Audio Source Lerp ");
         }
         float num2 = Mathf.Lerp(AudioUtils.DBToValue(from), AudioUtils.DBToValue(to), value);
         unitySound.volume = num2;
         if (showDebug)
         {
             Debug.Log(base.name + " Current Volume = " + num2);
         }
     }
 }
예제 #2
0
 public override void Process()
 {
     base.Process();
     if (sound != null)
     {
         if (affectVolume)
         {
             float volume = Mathf.Lerp(volumeMin, volumeMax, input.value);
             sound.SetVolume(volume);
         }
         if (affectLowPassFilter)
         {
             float lowPass = Mathf.Lerp(lowPassMin, lowPassMax, input.value);
             sound.SetLowPass(lowPass);
         }
         if (affectPitch)
         {
             float pitch = Mathf.Lerp(pitchMin, pitchMax, input.value);
             sound.SetPitch(pitch);
         }
     }
     else if (unitySound != null)
     {
         if (affectVolume)
         {
             float volume2 = Mathf.Lerp(volumeMin, volumeMax, input.value);
             unitySound.volume = volume2;
         }
         if (affectLowPassFilter)
         {
             float cutoffFrequency        = Mathf.Lerp(lowPassMin, lowPassMax, input.value);
             AudioLowPassFilter component = unitySound.GetComponent <AudioLowPassFilter>();
             component.cutoffFrequency = cutoffFrequency;
         }
         if (affectPitch)
         {
             float pitch2 = Mathf.Lerp(pitchMin, pitchMax, input.value);
             unitySound.pitch = pitch2;
         }
     }
 }