public static Obj_AI_Base GetBestObjectFarFrom(Vector3 Position) { var minion = AllyMinionManager.GetFurthestTo(Position); var ally = AllyHeroManager.GetFurthestTo(Position); var ward = WardManager.GetFurthestTo(Position); var miniondistance = minion != null?Extensions.Distance(Position, minion, true) : 0; var allydistance = ally != null?Extensions.Distance(Position, ally, true) : 0; var warddistance = ward != null?Extensions.Distance(Position, ward, true) : 0; var best = Math.Max(miniondistance, Math.Max(allydistance, warddistance)); if (best > 0f) { if (best == allydistance) { return(ally); } else if (best == miniondistance) { return(minion); } else if (best == warddistance) { return(ward); } } return(null); }
public static Obj_AI_Base GetBestObjectFarFrom(Vector3 position) { var minion = AllyMinionManager.GetFurthestTo(position); var ally = AllyHeroManager.GetFurthestTo(position); var ward = WardManager.GetFurthestTo(position); var miniondistance = minion != null?position.Distance(minion, true) : 0; var allydistance = ally != null?position.Distance(ally, true) : 0; var warddistance = ward != null?position.Distance(ward, true) : 0; var best = Math.Max(miniondistance, Math.Max(allydistance, warddistance)); if (best > 0f) { if (Math.Abs(best - allydistance) < float.Epsilon) { return(ally); } if (Math.Abs(best - miniondistance) < float.Epsilon) { return(minion); } if (Math.Abs(best - warddistance) < float.Epsilon) { return(ward); } } return(null); }