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); }
public static Obj_AI_Base GetBestObjectNearTo(Vector3 Position) { var minion = AllyMinionManager.GetNearestTo(Position); var ally = AllyHeroManager.GetNearestTo(Position); var ward = WardManager.GetNearestTo(Position); var miniondistance = minion != null?Extensions.Distance(Position, minion, true) : 999999999f; var allydistance = ally != null?Extensions.Distance(Position, ally, true) : 999999999f; var warddistance = ward != null?Extensions.Distance(Position, ward, true) : 999999999f; var best = Math.Min(miniondistance, Math.Min(allydistance, warddistance)); if (best <= Math.Pow(250f, 2)) { if (best == allydistance) { return(ally); } else if (best == miniondistance) { return(minion); } else if (best == warddistance) { return(ward); } } return(null); }
public static Obj_AI_Base GetBestObjectNearTo(Vector3 position) { var minion = AllyMinionManager.GetNearestTo(position); var ally = AllyHeroManager.GetNearestTo(position); var ward = WardManager.GetNearestTo(position); var miniondistance = minion != null?position.Distance(minion, true) : 999999999f; var allydistance = ally != null?position.Distance(ally, true) : 999999999f; var warddistance = ward != null?position.Distance(ward, true) : 999999999f; var best = Math.Min(miniondistance, Math.Min(allydistance, warddistance)); if (best <= Math.Pow(250f, 2)) { 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); }