public static bool Approach(ref float inVal, float inTarget, float inApproachSpeed) { Ross_Utils.Assert(inApproachSpeed >= 0); if (inVal < inTarget) { inVal += inApproachSpeed; if ((inVal) >= inTarget) { inVal = inTarget; return(true); } } else if (inVal > inTarget) { inVal -= inApproachSpeed; if ((inVal) <= inTarget) { inVal = inTarget; return(true); } } return(false); }
//---------------------------------------------- public AchievementDetails GetAchievementDetails(Profile.Enum2 inAchievement) { for (int i = 0; i < achievementDetailsList.Length; i++) { if (achievementDetailsList[i].achievementType == inAchievement) { return(achievementDetailsList[i]); } } Ross_Utils.Assert(false); return(achievementDetailsList[0]); }
public static float GetCosInterpolation(float inVal, float inMin, float inMax) { if (inVal < inMin) { inVal = inMin; } if (inVal > inMax) { inVal = inMax; } float range = inMax - inMin; Ross_Utils.Assert(range != 0.0f); float ratio = (inMax - inVal) / (inMax - inMin); ratio *= 4095.999f; Ross_Utils.Assert(initialised); return(preCalculatedCos[(int)ratio]); }