mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-14 13:45:10 +00:00
b876934b73
* license change replace unneeded package * reword this
22 lines
No EOL
535 B
C#
22 lines
No EOL
535 B
C#
using UnityEngine;
|
|
|
|
namespace HeavenStudio.Util
|
|
{
|
|
public static class MathUtils
|
|
{
|
|
public static float Round2Nearest(float value, float nearest)
|
|
{
|
|
return Mathf.Round(value / nearest) * nearest;
|
|
}
|
|
|
|
public static float Normalize(float value, float min, float max)
|
|
{
|
|
return (value - min) / (max - min);
|
|
}
|
|
|
|
public static bool IsBetween(this float value, float min, float max)
|
|
{
|
|
return value >= min && value <= max;
|
|
}
|
|
}
|
|
} |