diff options
Diffstat (limited to 'Impostor-dev/src/Impostor.Api/Innersloth/FloatRange.cs')
-rw-r--r-- | Impostor-dev/src/Impostor.Api/Innersloth/FloatRange.cs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Impostor-dev/src/Impostor.Api/Innersloth/FloatRange.cs b/Impostor-dev/src/Impostor.Api/Innersloth/FloatRange.cs new file mode 100644 index 0000000..c8a0824 --- /dev/null +++ b/Impostor-dev/src/Impostor.Api/Innersloth/FloatRange.cs @@ -0,0 +1,22 @@ +using Impostor.Api.Unity; + +namespace Impostor.Api.Innersloth +{ + public class FloatRange + { + private readonly float _min; + private readonly float _max; + + public FloatRange(float min, float max) + { + _min = min; + _max = max; + } + + public float Width => _max - _min; + + public float Lerp(float v) => Mathf.Lerp(_min, _max, v); + + public float ReverseLerp(float t) => Mathf.Clamp((t - _min) / Width, 0.0f, 1f); + } +}
\ No newline at end of file |