bad-piggies-0.1.3-porting/Assets/Scripts/Assembly-CSharp/PitchRandomizer.cs

18 lines
448 B
C#
Raw Permalink Normal View History

2024-02-24 22:40:44 -05:00
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);
}
}