changed directory structure

This commit is contained in:
Sebastian Bularca
2026-04-02 07:22:33 +02:00
parent 101a7ae81a
commit 81b8eadaf1
323 changed files with 5 additions and 5 deletions

View File

@@ -0,0 +1,45 @@
using System;
using UnityEngine;
namespace Jovian.Utilities {
public abstract class NumberRange<T> {
public T min;
public T max;
public abstract float Lerp(float t);
public abstract float LerpUnclamped(float t);
// returns 0 to 1
public abstract float InverseLerp(float t);
// returns values -1 to 1
public abstract float InverseLerpSigned(float t);
public abstract T Random();
}
[Serializable]
public class FloatRange : NumberRange<float> {
public FloatRange(float min, float max) {
this.min = min;
this.max = max;
}
public override float Lerp(float t) => Mathf.Lerp(min, max, t);
public override float LerpUnclamped(float t) => Mathf.LerpUnclamped(min, max, t);
public override float InverseLerp(float t) => Mathf.InverseLerp(min, max, t);
public override float InverseLerpSigned(float t) => Mathf.InverseLerp(min, max, t) * 2f - 1f;
public override float Random() => UnityEngine.Random.Range(min, max);
}
[Serializable]
public class IntRange : NumberRange<int> {
public IntRange(int min, int max) {
this.min = min;
this.max = max;
}
public override float Lerp(float t) => Mathf.Lerp(min, max, t);
public override float LerpUnclamped(float t) => Mathf.LerpUnclamped(min, max, t);
public override float InverseLerp(float t) => Mathf.InverseLerp(min, max, t);
public override float InverseLerpSigned(float t) => Mathf.InverseLerp(min, max, t) * 2f - 1f;
public override int Random() => UnityEngine.Random.Range(min, max);
}
}