public static Int64 MoveTowards(Int64 current, Int64 target, Int64 maxDelta) { if (Lib.Abs(target - current) <= maxDelta) { return(target); } return(current + Lib.Sign(target - current) * maxDelta); }