bad-piggies-0.1.3-porting/Assets/Scripts/Assembly-CSharp/PitchRandomizer.cs
2024-02-24 22:40:44 -05:00

17 lines
448 B
C#

using UnityEngine;
public class PitchRandomizer : AudioFX
{
public float m_pitchMin;
public float m_pitchMax;
protected override void ProcessAudio()
{
base.ProcessAudio();
Assert.Check(m_pitchMin <= m_pitchMax, "PitchRandomizer: Min pitch is larger than max, GameObject:" + base.name);
Mathf.Clamp(m_pitchMin, -3f, m_pitchMax);
Mathf.Clamp(m_pitchMax, m_pitchMin, 3f);
base.audio.pitch = Random.Range(m_pitchMin, m_pitchMax);
}
}