Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }