Aka_s_Vayne.Variables.IsValidTargetEx C# (CSharp) Метод

IsValidTargetEx() публичный статический Метод

public static IsValidTargetEx ( this unit, float range, bool checkTeam = true, System.Vector3 from = default(Vector3) ) : bool
unit this
range float
checkTeam bool
from System.Vector3
Результат bool
        public static bool IsValidTargetEx(
    this AttackableUnit unit,
    float range,
    bool checkTeam = true,
    Vector3 from = default(Vector3))
        {
            var ai = unit as Obj_AI_Base;

            if ((ai != null && ai.HasBuff("kindredrnodeathbuff") && ai.HealthPercent <= 10.0)
                || checkTeam && unit.Team == ObjectManager.Player.Team)
            {
                return false;
            }

            var targetPosition = ai != null ? ai.ServerPosition : unit.Position;
            var fromPosition = from.To2D().IsValid() ? from.To2D() : ObjectManager.Player.ServerPosition.To2D();

            var distance2 = Vector2.DistanceSquared(fromPosition, targetPosition.To2D());
            return distance2 <= range * range;
        }