46 lines
1017 B
C#
Executable File
46 lines
1017 B
C#
Executable File
using System;
|
|
using UnityEngine;
|
|
|
|
namespace RebootKit.Engine.Foundation {
|
|
[Serializable]
|
|
public struct FloatRange {
|
|
public float min;
|
|
public float max;
|
|
|
|
public FloatRange(float min, float max) {
|
|
this.min = min;
|
|
this.max = max;
|
|
}
|
|
|
|
public float Lerp(float t) {
|
|
return Mathf.Lerp(min, max, t);
|
|
}
|
|
|
|
public float Random() {
|
|
return UnityEngine.Random.Range(min, max);
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public struct IntRange {
|
|
public int min;
|
|
public int max;
|
|
|
|
public IntRange(int min, int max) {
|
|
this.min = min;
|
|
this.max = max;
|
|
}
|
|
|
|
public int Lerp(float t) {
|
|
return (int) Mathf.Lerp(min, max, t);
|
|
}
|
|
|
|
public int RandomInclusive() {
|
|
return UnityEngine.Random.Range(min, max + 1);
|
|
}
|
|
|
|
public int RandomExclusive() {
|
|
return UnityEngine.Random.Range(min, max);
|
|
}
|
|
}
|
|
} |