private static List <BotController> ByDistance(BotController myself, List <BotController> them, bool nearIsPriority) { List <BotController> working = new List <BotController>(them); working.Sort((x, y) => { return((nearIsPriority ? 1 : -1) * TargetHelper.Distance(myself, x).CompareTo(TargetHelper.Distance(myself, y))); }); return(working); }
private static bool DistanceBetween(BotController myself, BotController target, float min, float max) { float distance = TargetHelper.Distance(myself, target); return(min <= distance && distance <= max); }