forked from MoonsideGames/MoonWorks
add int variant to MathHelper.Approach
parent
c96c7a0d90
commit
ec5160c060
|
@ -354,6 +354,19 @@ namespace MoonWorks.Math
|
|||
/// <param name="end">End value.</param>
|
||||
/// <param name="change">Change value.</param>
|
||||
public static float Approach(float start, float end, float change)
|
||||
{
|
||||
return start < end ?
|
||||
System.Math.Min(start + change, end) :
|
||||
System.Math.Max(start - change, end);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Step from start towards end by change.
|
||||
/// </summary>
|
||||
/// <param name="start">Start value.</param>
|
||||
/// <param name="end">End value.</param>
|
||||
/// <param name="change">Change value.</param>
|
||||
public static int Approach(int start, int end, int change)
|
||||
{
|
||||
return start < end ?
|
||||
System.Math.Min(start + change, end) :
|
||||
|
|
Loading…
Reference in New Issue