当前位置: 首页>>代码示例>>C#>>正文


C# Obj_AI_Hero.DistanceToPlayer方法代码示例

本文整理汇总了C#中Obj_AI_Hero.DistanceToPlayer方法的典型用法代码示例。如果您正苦于以下问题:C# Obj_AI_Hero.DistanceToPlayer方法的具体用法?C# Obj_AI_Hero.DistanceToPlayer怎么用?C# Obj_AI_Hero.DistanceToPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Obj_AI_Hero的用法示例。


在下文中一共展示了Obj_AI_Hero.DistanceToPlayer方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InsecCombo

        public static void InsecCombo(Obj_AI_Hero target)
        {
            if (target == null)
            {
                return;
            }

            if (ObjectManager.Player.Distance(GetInsecPos(target)) < 200)
            {
                insecComboStep = InsecComboStepSelect.Pressr;
            }
            else if ((insecComboStep == InsecComboStepSelect.None)
                     && (GetInsecPos(target).Distance(ObjectManager.Player.Position) < 600))
            {
                insecComboStep = InsecComboStepSelect.Wgapclose;
            }
            else if ((insecComboStep == InsecComboStepSelect.None)
                     && (target.Distance(ObjectManager.Player) < LeeSin.spells[LeeSin.Spells.Q].Range))
            {
                insecComboStep = InsecComboStepSelect.Qgapclose;
            }

            switch (insecComboStep)
            {
                case InsecComboStepSelect.Qgapclose:
                    if (Misc.IsQOne)
                    {
                        var pred1 = LeeSin.spells[LeeSin.Spells.Q].GetPrediction(target);
                        if (pred1.Hitchance >= HitChance.High)
                        {
                            LeeSin.CastQ(target, Misc.GetMenuItem("ElLeeSin.Smite.Q"));
                        }

                        if (!Misc.GetMenuItem("checkOthers2"))
                        {
                            return;
                        }

                        var insectObjects =
                            HeroManager.Enemies.Where(
                                    x =>
                                        x.IsValidTarget(LeeSin.spells[LeeSin.Spells.Q].Range) && !x.Compare(target)
                                        && (LeeSin.spells[LeeSin.Spells.Q].GetHealthPrediction(x)
                                            > LeeSin.spells[LeeSin.Spells.Q].GetDamage(x))
                                        && (x.Distance(target) < target.DistanceToPlayer()) && (x.Distance(target) < 750))
                                .Concat(
                                    MinionManager.GetMinions(
                                        ObjectManager.Player.ServerPosition,
                                        LeeSin.spells[LeeSin.Spells.Q].Range,
                                        MinionTypes.All,
                                        MinionTeam.NotAlly))
                                .Where(
                                    m =>
                                        m.IsValidTarget(LeeSin.spells[LeeSin.Spells.Q].Range)
                                        && LeeSin.spells[LeeSin.Spells.Q].GetHealthPrediction(m)
                                        > LeeSin.spells[LeeSin.Spells.Q].GetDamage(m) && m.Distance(target) < 400f)
                                .OrderBy(i => i.Distance(target))
                                .FirstOrDefault();

                        if (insectObjects == null)
                        {
                            return;
                        }

                        LeeSin.spells[LeeSin.Spells.Q].Cast(insectObjects);
                    }

                    if (!target.HasQBuff() && Misc.IsQOne)
                    {
                        LeeSin.CastQ(target, Misc.GetMenuItem("ElLeeSin.Smite.Q"));
                    }
                    else if (target.HasQBuff())
                    {
                        LeeSin.spells[LeeSin.Spells.Q].Cast();
                        insecComboStep = InsecComboStepSelect.Wgapclose;
                    }
                    else
                    {
                        if (LeeSin.spells[LeeSin.Spells.Q].Instance.Name.Equals(
                                "blindmonkqtwo",
                                StringComparison.InvariantCultureIgnoreCase)
                            && (Misc.ReturnQBuff()?.Distance(target) <= 600))
                        {
                            LeeSin.spells[LeeSin.Spells.Q].Cast();
                        }
                    }
                    break;

                case InsecComboStepSelect.Wgapclose:

                    if (ObjectManager.Player.Distance(target) < WardRange)
                    {
                        Wardmanager.WardJump(GetInsecPos(target), false, true, true);

                        if ((Wardmanager.FindBestWardItem() == null) && LeeSin.spells[LeeSin.Spells.R].IsReady()
                            && Misc.GetMenuItem("ElLeeSin.Flash.Insec")
                            && (ObjectManager.Player.Spellbook.CanUseSpell(LeeSin.flashSlot) == SpellState.Ready))
                        {
                            if (((GetInsecPos(target).Distance(ObjectManager.Player.Position) < FlashRange)
                                 && (Wardmanager.LastWard + 1000 < Environment.TickCount)) || !LeeSin.spells[LeeSin.Spells.W].IsReady())
//.........这里部分代码省略.........
开发者ID:AlterEgojQuery,项目名称:Will-update,代码行数:101,代码来源:InsecManager.cs

示例2: IsInRangeQ

 private static bool IsInRangeQ(Obj_AI_Hero target)
 {
     var distPlayer = target.DistanceToPlayer();
     var distW = wShadow.IsValid() ? wShadow.Distance(target) : float.MaxValue;
     var distR = rShadow.IsValid() ? rShadow.Distance(target) : float.MaxValue;
     return Math.Min(Math.Min(distR, distW), distPlayer) < Q.Range + Q.Width / 2;
 }
开发者ID:Inuyalx,项目名称:LeagueSharp,代码行数:7,代码来源:Zed.cs

示例3: Swap

 private static void Swap(Obj_AI_Hero target)
 {
     var eCanKill = E.CanCast(target) && target.Health + target.PhysicalShield <= E.GetDamage(target);
     if (MainMenu["Combo"]["SwapIfKill"])
     {
         if (IsKillByMark(target) || eCanKill)
         {
             SwapCountEnemy();
         }
     }
     if (Player.HealthPercent < MainMenu["Combo"]["SwapIfHpU"])
     {
         if (IsKillByMark(target) || !eCanKill || Player.HealthPercent < target.HealthPercent)
         {
             SwapCountEnemy();
         }
     }
     else if (MainMenu["Combo"]["SwapGap"].GetValue<MenuList>().Index > 0 && !E.IsInRange(target)
              && !IsKillByMark(target))
     {
         var playerDist = target.DistanceToPlayer();
         var wDist = WState == 1 && wShadow.IsValid() ? wShadow.Distance(target) : float.MaxValue;
         var rDist = RState == 1 && rShadow.IsValid() ? rShadow.Distance(target) : float.MaxValue;
         var minDist = Math.Min(Math.Min(wDist, rDist), playerDist);
         if (minDist < playerDist)
         {
             switch (MainMenu["Combo"]["SwapGap"].GetValue<MenuList>().Index)
             {
                 case 1:
                     if (Math.Abs(minDist - wDist) < float.Epsilon)
                     {
                         var comboW = GetCombo(
                             target,
                             Q.IsReady() && minDist < Q.Range,
                             false,
                             E.IsReady() && minDist < E.Range,
                             MainMenu["Combo"]["R"] && MainMenu["Combo"]["RCast" + target.ChampionName]
                             && RState == 0 && minDist < R.Range);
                         if (minDist > target.GetRealAutoAttackRange())
                         {
                             comboW[0] -= Player.GetAutoAttackDamage(target);
                         }
                         if (target.Health + target.PhysicalShield <= comboW[0] && Player.Mana >= comboW[1]
                             && W.Cast())
                         {
                             return;
                         }
                         if (MainMenu["Combo"]["R"] && MainMenu["Combo"]["RCast" + target.ChampionName]
                             && RState == 0 && !R.IsInRange(target) && minDist < R.Range
                             && (MainMenu["Combo"]["RMode"].GetValue<MenuList>().Index == 0 || CanR)
                             && W.Cast())
                         {
                             return;
                         }
                     }
                     else if (Math.Abs(minDist - rDist) < float.Epsilon)
                     {
                         var comboR = GetCombo(
                             target,
                             Q.IsReady() && minDist < Q.Range,
                             false,
                             E.IsReady() && minDist < E.Range,
                             false);
                         if (minDist > target.GetRealAutoAttackRange())
                         {
                             comboR[0] -= Player.GetAutoAttackDamage(target);
                         }
                         if (target.Health + target.PhysicalShield <= comboR[0] && Player.Mana >= comboR[1]
                             && R.Cast())
                         {
                             return;
                         }
                     }
                     if (minDist < E.Range && target.HealthPercent <= 20
                         && target.HealthPercent < Player.HealthPercent && (Q.IsReady() || E.IsReady()))
                     {
                         if (Math.Abs(minDist - wDist) < float.Epsilon)
                         {
                             W.Cast();
                         }
                         else if (Math.Abs(minDist - rDist) < float.Epsilon)
                         {
                             R.Cast();
                         }
                     }
                     break;
                 case 2:
                     if (minDist <= 500)
                     {
                         if (Math.Abs(minDist - wDist) < float.Epsilon)
                         {
                             W.Cast();
                         }
                         else if (Math.Abs(minDist - rDist) < float.Epsilon)
                         {
                             R.Cast();
                         }
                     }
                     break;
             }
//.........这里部分代码省略.........
开发者ID:Inuyalx,项目名称:LeagueSharp,代码行数:101,代码来源:Zed.cs

示例4: CanW

 private static SpellSlot CanW(Obj_AI_Hero target)
 {
     if (Q.IsReady() && Player.Mana >= Q.Instance.ManaCost + W.Instance.ManaCost
         && target.DistanceToPlayer() < W.Range + Q.Range)
     {
         return SpellSlot.Q;
     }
     if (E.IsReady() && Player.Mana >= E.Instance.ManaCost + W.Instance.ManaCost
         && target.DistanceToPlayer() < W.Range + E.Range)
     {
         return SpellSlot.E;
     }
     return SpellSlot.Unknown;
 }
开发者ID:Inuyalx,项目名称:LeagueSharp,代码行数:14,代码来源:Zed.cs

示例5: Start

 internal static void Start(Obj_AI_Hero target)
 {
     if (CanRFlash)
     {
         var lastSpell = Player.GetLastCastedSpell();
         if (lastSpell.IsValid && lastSpell.Name == R.Instance.SData.Name
             && Variables.TickCount - lastSpell.StartTime < 2000)
         {
             var targetRFlash = lastSpell.Target as Obj_AI_Hero;
             if (targetRFlash != null && targetRFlash.IsValidTarget(FlashRange)
                 && targetRFlash.Health + targetRFlash.PhysicalShield > R.GetDamage(targetRFlash))
             {
                 Player.Spellbook.CastSpell(
                     Flash,
                     targetRFlash.ServerPosition.ToVector2()
                         .Extend(GetPositionKickTo(targetRFlash), -GetDistBehind(targetRFlash))
                         .ToVector3());
                 return;
             }
         }
     }
     if (Variables.Orbwalker.CanMove() && Variables.TickCount - lastMoveTime > 250)
     {
         if (target != null && lastMoveTime > 0 && CanInsec
             && GetPositionKickTo(target).DistanceToPlayer() > target.Distance(GetPositionKickTo(target)))
         {
             Variables.Orbwalker.Move(
                 target.ServerPosition.Extend(GetPositionKickTo(target), -GetDistBehind(target)));
         }
         else
         {
             Variables.Orbwalker.Move(Game.CursorPos);
         }
     }
     if (target == null || !CanInsec)
     {
         return;
     }
     if (!IsRecent)
     {
         var checkFlash = GapCheck(target, true);
         var checkJump = GapCheck(target);
         if (!Player.HasBuff("blindmonkqtwodash") && !canJumpFlash && !checkFlash.Item2 && !checkJump.Item2
             && CanJumpFlash
             && target.DistanceToPlayer()
             < WardManager.WardRange
             + (MainMenu["Insec"]["FlashMode"].GetValue<MenuList>().Index == 0 ? R.Range : FlashRange)
             - GetDistBehind(target))
         {
             canJumpFlash = true;
         }
         if (!canJumpFlash)
         {
             if (MainMenu["Insec"]["PriorFlash"])
             {
                 if (MainMenu["Insec"]["Flash"] && checkFlash.Item2)
                 {
                     GapByFlash(target, checkFlash.Item1);
                 }
                 else if (checkJump.Item2)
                 {
                     GapByWardJump(target, checkJump.Item1);
                 }
             }
             else
             {
                 if (checkJump.Item2)
                 {
                     GapByWardJump(target, checkJump.Item1);
                 }
                 else if (MainMenu["Insec"]["Flash"] && checkFlash.Item2)
                 {
                     GapByFlash(target, checkFlash.Item1);
                 }
             }
         }
         else
         {
             Flee(target.ServerPosition.Extend(GetPositionKickTo(target), -GetDistBehind(target)));
         }
     }
     if (R.IsInRange(target))
     {
         var posEnd = GetPositionKickTo(target);
         if (posEnd.DistanceToPlayer() > target.Distance(posEnd))
         {
             var posTarget = target.ServerPosition.ToVector2();
             var project = posTarget.Extend(Player.ServerPosition, -KickRange)
                 .ProjectOn(posTarget, posEnd.Extend(posTarget, -(KickRange * 0.5f)));
             if (project.IsOnSegment && project.SegmentPoint.Distance(posEnd) <= KickRange * 0.5f
                 && R.CastOnUnit(target))
             {
                 return;
             }
         }
     }
     if (!CanJumpFlash || !canJumpFlash)
     {
         GapByQ(target);
     }
//.........这里部分代码省略.........
开发者ID:47110572,项目名称:LeagueSharp-10,代码行数:101,代码来源:LeeSin.cs

示例6: GapByQ

 private static void GapByQ(Obj_AI_Hero target)
 {
     if (!MainMenu["Insec"]["Q"] || !Q.IsReady())
     {
         return;
     }
     var minDist = WardManager.WardRange - GetDistBehind(target);
     if (IsQOne)
     {
         var pred = Q.VPrediction(target);
         if (pred.Hitchance == HitChance.Collision || pred.Hitchance == HitChance.OutOfRange)
         {
             if (pred.Hitchance == HitChance.Collision && MainMenu["Insec"]["QCol"] && Smite.IsReady()
                 && !pred.CollisionObjects.Any(i => i.IsMe))
             {
                 var col =
                     pred.CollisionObjects.Select(i => i as Obj_AI_Minion).Where(i => i.IsValid()).ToList();
                 if (col.Count == 1
                     && col.Any(i => i.Health <= GetSmiteDmg && i.DistanceToPlayer() < SmiteRange)
                     && Player.Spellbook.CastSpell(Smite, col.First()))
                 {
                     Q.Cast(pred.CastPosition);
                     return;
                 }
             }
             if (MainMenu["Insec"]["QObj"])
             {
                 foreach (var predNear in
                     GameObjects.EnemyHeroes.Where(i => i.NetworkId != target.NetworkId)
                         .Cast<Obj_AI_Base>()
                         .Concat(
                             GameObjects.EnemyMinions.Where(i => i.IsMinion() || i.IsPet())
                                 .Concat(GameObjects.Jungle))
                         .Where(
                             i =>
                             i.IsValidTarget(Q.Range) && Q.GetHealthPrediction(i) > Q.GetDamage(i)
                             && target.DistanceToPlayer() > i.Distance(target)
                             && i.Distance(target) < minDist - 80)
                         .OrderBy(i => i.Distance(target))
                         .Select(i => Q.VPrediction(i))
                         .Where(i => i.Hitchance >= Q.MinHitChance)
                         .OrderByDescending(i => i.Hitchance))
                 {
                     Q.Cast(predNear.CastPosition);
                 }
             }
         }
         else if (pred.Hitchance >= Q.MinHitChance)
         {
             Q.Cast(pred.CastPosition);
         }
     }
     else if (target.DistanceToPlayer() > minDist
              && (HaveQ(target) || (GetQ2Obj != null && target.Distance(GetQ2Obj) < minDist - 80))
              && ((WardManager.CanWardJump && Player.Mana >= 80)
                  || (MainMenu["Insec"]["Flash"] && Flash.IsReady())) && Q.Cast())
     {
         Variables.TargetSelector.SetTarget(target);
     }
 }
开发者ID:47110572,项目名称:LeagueSharp-10,代码行数:60,代码来源:LeeSin.cs

示例7: Start

 internal static void Start(Obj_AI_Hero target)
 {
     if (CanRFlash && objR.Health + objR.PhysicalShield > R.GetDamage(objR)
         && Player.Spellbook.CastSpell(Flash, GetPositionBehind(objR)))
     {
         return;
     }
     if (Variables.Orbwalker.CanMove() && Variables.TickCount - lastMoveTime > 1000)
     {
         if (target != null && lastMoveTime > 0 && CanInsec
             && GetPositionKickTo(target).DistanceToPlayer() > target.Distance(GetPositionKickTo(target)))
         {
             Variables.Orbwalker.Move(GetPositionBehind(target));
         }
         else
         {
             Variables.Orbwalker.Move(Game.CursorPos);
         }
     }
     if (target == null || !CanInsec)
     {
         return;
     }
     if ((!CanJumpFlash || !canJumpFlash) && GapByQ(target))
     {
         return;
     }
     if (!IsRecent)
     {
         var checkFlash = GapCheck(target, true);
         var checkJump = GapCheck(target);
         if (!isDashing && CanJumpFlash && !canJumpFlash && !checkFlash.Item2 && !checkJump.Item2
             && target.DistanceToPlayer() < WardManager.WardRange + R.Range)
         {
             canJumpFlash = true;
         }
         if (!canJumpFlash)
         {
             if (checkJump.Item2)
             {
                 GapByWardJump(target, checkJump.Item1);
                 return;
             }
             if (MainMenu["Insec"]["Flash"] && checkFlash.Item2)
             {
                 GapByFlash(target, checkFlash.Item1);
                 return;
             }
         }
         else if (WardManager.Place(target.ServerPosition, false, true))
         {
             return;
         }
     }
     if (R.IsInRange(target))
     {
         var posEnd = GetPositionKickTo(target);
         if (posEnd.DistanceToPlayer() > target.Distance(posEnd))
         {
             var posTarget = target.ServerPosition.ToVector2();
             var project = posTarget.Extend(Player.ServerPosition, -KickRange)
                 .ProjectOn(posTarget, posEnd.Extend(posTarget, -(KickRange * 0.5f)));
             if (project.IsOnSegment && project.SegmentPoint.Distance(posEnd) <= KickRange * 0.5f)
             {
                 R.CastOnUnit(target);
             }
         }
     }
 }
开发者ID:Inuyalx,项目名称:LeagueSharp,代码行数:69,代码来源:LeeSin.cs

示例8: GapByQ

 private static bool GapByQ(Obj_AI_Hero target)
 {
     if (!MainMenu["Insec"]["Q"] || !Q.IsReady())
     {
         return false;
     }
     var minDist = CanJumpFlash
                       ? WardManager.WardRange + R.Range
                       : WardManager.WardRange - GetDistBehind(target);
     if (IsQOne)
     {
         var pred = Q.VPrediction(target, false, CollisionableObjects.YasuoWall);
         if (pred.Hitchance >= Q.MinHitChance)
         {
             var col = pred.VCollision();
             if (col.Count == 0 && Q.Cast(pred.CastPosition))
             {
                 return true;
             }
             if (Smite.IsReady() && col.Count == 1 && MainMenu["Insec"]["QCol"])
             {
                 var obj = col.First();
                 if (obj.Health <= GetSmiteDmg && obj.DistanceToPlayer() < SmiteRange
                     && Player.Spellbook.CastSpell(Smite, obj))
                 {
                     Q.Cast(pred.CastPosition);
                     return true;
                 }
             }
         }
         if (!MainMenu["Insec"]["QObj"])
         {
             return false;
         }
         if (
             GameObjects.EnemyHeroes.Where(i => i.NetworkId != target.NetworkId)
                 .Cast<Obj_AI_Base>()
                 .Concat(
                     GameObjects.EnemyMinions.Where(i => i.IsMinion() || i.IsPet())
                         .Concat(GameObjects.Jungle))
                 .Where(
                     i =>
                     i.IsValidTarget(Q.Range) && Q.GetHealthPrediction(i) > Q.GetDamage(i)
                     && target.DistanceToPlayer() > i.Distance(target) && i.Distance(target) < minDist - 80)
                 .OrderBy(i => i.Distance(target))
                 .Select(i => Q.VPrediction(i))
                 .Where(i => i.Hitchance >= Q.MinHitChance)
                 .OrderByDescending(i => i.Hitchance)
                 .Any(i => Q.Cast(i.CastPosition)))
         {
             return true;
         }
     }
     else if (target.DistanceToPlayer() > minDist
              && (HaveQ(target) || (objQ.IsValidTarget(Q2.Range) && target.Distance(objQ) < minDist - 80))
              && ((WardManager.CanWardJump && Player.Mana >= 80)
                  || (MainMenu["Insec"]["Flash"] && Flash.IsReady())) && Q.Cast())
     {
         Variables.TargetSelector.SetTarget(target);
         return true;
     }
     return false;
 }
开发者ID:Inuyalx,项目名称:LeagueSharp,代码行数:63,代码来源:LeeSin.cs


注:本文中的Obj_AI_Hero.DistanceToPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。