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


C# AttackableUnit.Distance方法代码示例

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


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

示例1: Obj_AI_Base_OnDamage

        private static void Obj_AI_Base_OnDamage(AttackableUnit sender, AttackableUnitDamageEventArgs args)
        {
            var caster = sender as AIHeroClient;
            var target = args.Target as AIHeroClient;

            if (caster == null || target == null || sender.Distance(Player.Instance) > 1500) return;

            HitMarkPosition = args.Target.Position.WorldToScreen();
            CanDrawHitMarker = true;
            HitMarkerSound.Play();

            var hero = AkbarSpells.Spells.FirstOrDefault(x => x.Hero == Player.Instance.Hero && !caster.Spellbook.GetSpell(x.Slot).IsReady);
            if (args.Source.IsMe && hero!= null && args.Target.IsEnemy)
            {
                AkbarSound.Play();
            }
  
            if (hero != null && sender.IsVisible && !caster.Spellbook.GetSpell(SpellSlot.R).IsReady)
            {
                if (hero.Hero == Champion.JarvanIV || hero.Hero == Champion.Darius || hero.Hero == Champion.Aatrox)
                {
                    DunkSound.Play();
                }
            }
            Core.DelayAction(() => CanDrawHitMarker = false, 200);
        }
开发者ID:HeheheM,项目名称:EB,代码行数:26,代码来源:Program.cs

示例2: Orbwalker_OnPreAttack

 private static void Orbwalker_OnPreAttack(AttackableUnit target, Orbwalker.PreAttackArgs args)
 {
     if (Orbwalker.ActiveModesFlags == Orbwalker.ActiveModes.None  || _lastChange + 300 > Environment.TickCount) return;
     var selectedUnit = target as AIHeroClient;
     if (selectedUnit != null && (Program.HarassMenu["useQHarass"].Cast<CheckBox>().CurrentValue && Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Harass) || Program.ComboMenu["useQCombo"].Cast<CheckBox>().CurrentValue && Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo)))
     {
         if (selectedUnit.CountEnemiesInRange(AoeRadius) > 2 || _Player.GetAutoAttackDamage(selectedUnit) * 1.1 >= target.Health + target.AttackShield && _Player.GetAutoAttackDamage(selectedUnit) < target.Health + target.AttackShield)
         {
             if (!FishBonesActive)
             {
                 Program.Spells[SpellSlot.Q].Cast();
                 _lastChange = Environment.TickCount;
             }
         }
         else
         {
             if (FishBonesActive && target.Distance(_Player) < MinigunRange(selectedUnit))
             {
                 Program.Spells[SpellSlot.Q].Cast();
                 _lastChange = Environment.TickCount;
             }
         }
     }
     else
     {
         var minion = target as Obj_AI_Base;
         if (minion != null && minion.IsMinion && Program.FarmMenu["useQFarm"].Cast<CheckBox>().CurrentValue)
         {
             var count =
                 ObjectManager.Get<Obj_AI_Minion>()
                     .Count(
                         a =>
                             a.Health < _Player.GetAutoAttackDamage(a) * 1.1 && a.Distance(target) < AoeRadius &&
                             a.IsValidTarget());
             if (FishBonesActive && count < 2 && target.Distance(_Player) < MinigunRange(minion))
             {
                 Program.Spells[SpellSlot.Q].Cast();
                 _lastChange = Environment.TickCount;
             }
             else if (!FishBonesActive && count >= 2)
             {
                 Program.Spells[SpellSlot.Q].Cast();
                 _lastChange = Environment.TickCount;
             }
         }
     }
     args.Process = true;
 }
开发者ID:xlof,项目名称:Elobuddy-Addons-1,代码行数:48,代码来源:Events.cs

示例3: AfterAttack

 public static void AfterAttack(AttackableUnit target, EventArgs args)
 {
     if (target != null &&
         target.IsEnemy &&
         !target.IsInvulnerable &&
         !target.IsDead &&
         target is AIHeroClient &&
         target.Distance(Utils._Player) <= Spells.W.Range)
     {
         if ((Orbwalker.ActiveModesFlags == Orbwalker.ActiveModes.Harass ||
              Orbwalker.ActiveModesFlags == Orbwalker.ActiveModes.Combo) && Spells.W.IsReady())
         {
             if (Utils.isChecked(MenuX.Combo, "ComboQ") || Utils.isChecked(MenuX.Harass, "HarassW"))
                 Spells.W.Cast();
         }
     }
 }
开发者ID:HeheheM,项目名称:EloBuddy-1,代码行数:17,代码来源:Flags.cs

示例4: Orbwalker_OnPreAttack

        /*private static void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            Chat.Print("Failed Downloading: " + e.Error);
            AllahAkbar = new SoundPlayer
            {
                SoundLocation =
                    SandboxConfig.DataDirectory + @"\JinXXX\" + "Allahu_Akbar_Sound_Effect_Download_Link.wav"
            };
            AllahAkbar.Load();
        }*/
        /// <summary>
        /// Called Before Attack
        /// </summary>
        /// <param name="target">The Target</param>
        /// <param name="args">The Args</param>
        private static void Orbwalker_OnPreAttack(AttackableUnit target, Orbwalker.PreAttackArgs args)
        {
            #region Combo

            if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo))
            {
                var useQ = Config.ComboMenu["useQ"].Cast<CheckBox>().CurrentValue;

                // If the player has the rocket
                if (useQ && Program.Q.IsReady() && Essentials.FishBones())
                {
                    //var target = TargetSelector.GetTarget(Essentials.FishBonesRange(), DamageType.Physical);

                    if (target != null && target.IsValidTarget())
                    {
                        if (Player.Instance.Distance(target) <= Essentials.MinigunRange &&
                            target.CountEnemiesInRange(100) <
                            Config.ComboMenu["qCountC"].Cast<Slider>().CurrentValue)
                        {
                            Program.Q.Cast();
                            Orbwalker.ForcedTarget = target;
                        }
                    }
                }
            }

            #endregion

            #region LastHit

            if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.LastHit))
            {
                var useQ = Config.LastHitMenu["useQ"].Cast<CheckBox>().CurrentValue;
                var manaQ = Config.LastHitMenu["manaQ"].Cast<Slider>().CurrentValue;
                var qCountM = Config.LastHitMenu["qCountM"].Cast<Slider>().CurrentValue;

                // Force Minigun if there is a lasthittable minion in minigun range and there is no targets more than the setting amount.
                var kM = Orbwalker.LastHitMinionsList.Where(
                    t => t.IsEnemy &&
                         t.Health <= (Player.Instance.GetAutoAttackDamage(t) * 0.9) && t.IsValidTarget() &&
                         t.Distance(Player.Instance) <= Essentials.MinigunRange);
                if (useQ && Essentials.FishBones() && kM.Count() < qCountM)
                {
                    Program.Q.Cast();
                }
            }

            #endregion

            #region Lane Clear

            if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.LaneClear))
            {
                var minion = EntityManager.MinionsAndMonsters.GetLaneMinions(
                    EntityManager.UnitTeam.Enemy,
                    Player.Instance.ServerPosition,
                    Essentials.FishBonesRange()).OrderByDescending(t => t.Health);

                if (Essentials.FishBones())
                {
                    foreach (var m in minion)
                    {
                        var minionsAoe =
                            EntityManager.MinionsAndMonsters.EnemyMinions.Count(
                                t => t.IsValidTarget() && t.Distance(m) <= 100);

                        if (m.Distance(Player.Instance) <= Essentials.MinigunRange && m.IsValidTarget() &&
                            (minionsAoe < Config.LaneClearMenu["qCountM"].Cast<Slider>().CurrentValue ||
                             m.Health > (Player.Instance.GetAutoAttackDamage(m))))
                        {
                            Q.Cast();
                            Orbwalker.ForcedTarget = m;
                        }
                        else if (m.Distance(Player.Instance) <= Essentials.MinigunRange &&
                                 !Orbwalker.LastHitMinionsList.Contains(m))
                        {
                            Q.Cast();
                            Orbwalker.ForcedTarget = m;
                        }
                        else
                        {
                            foreach (
                                var kM in
                                    Orbwalker.LastHitMinionsList.Where(
                                        kM =>
//.........这里部分代码省略.........
开发者ID:KarmaPanda,项目名称:EloBuddy,代码行数:101,代码来源:Program.cs

示例5: Obj_AI_Base_OnDamage

        private static void Obj_AI_Base_OnDamage(AttackableUnit sender, AttackableUnitDamageEventArgs args)
        {
            
            var caster = sender as AIHeroClient;
            var target = args.Target as AIHeroClient;

            if (caster == null || target == null || sender.Distance(Player.Instance) > 1500) return;

            HitMarkPosition = args.Target.Position.WorldToScreen();
            CanDrawHitMarker = true;
            HitMarkerSound.Play();
  
            Core.DelayAction(() => CanDrawHitMarker = false, 200);
            
        }
开发者ID:mariogk,项目名称:Hu3,代码行数:15,代码来源:Program.cs

示例6: OrbwalkerOnOnPostAttack

        private static void OrbwalkerOnOnPostAttack(AttackableUnit target, EventArgs args)
        {
            // Use Q
            // No sense in checking if Q is off cooldown or enemy died
            if (SpellManager.Q.IsReady() && !target.IsDead && !Player.Instance.Buffs.Any(b => b.Name.Equals("XenZhaoComboTarget", StringComparison.CurrentCultureIgnoreCase) || b.Name.Equals("xenzhaocomboauto", StringComparison.CurrentCultureIgnoreCase) || b.Name.Equals("xenzhaocomboautofinish", StringComparison.CurrentCultureIgnoreCase)))
            {
                // Check if we should use Q to attack heroes
                if ((SettingsModes.Combo.UseQ && Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo)) ||
                    (Orbwalker.LaneClearAttackChamps && SettingsModes.LaneClear.UseQ &&
                     Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.LaneClear)))
                {
                    if (target is AIHeroClient && PlayerMana >= SettingsMana.MinQMana)
                    {
                        Debug.WriteChat("Casting Q, because attacking enemy in Combo or Harras");
                        SpellManager.Q.Cast();
                        Orbwalker.ResetAutoAttack();
                        Player.IssueOrder(GameObjectOrder.AttackUnit, target);
                    }
                }
                // Check if we should use Q to attack minions/monsters/turrets
                if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.LaneClear) ||
                    Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.JungleClear))
                {
                    if (target is Obj_AI_Minion && PlayerMana >= SettingsMana.MinQMana)
                    {
                        if (SettingsModes.JungleClear.UseQ && target.Team == GameObjectTeam.Neutral)
                        {
                            Debug.WriteChat("Casting Q, because attacking monster in Jungle Clear");
                            SpellManager.Q.Cast();
                            Orbwalker.ResetAutoAttack();
                            Player.IssueOrder(GameObjectOrder.AttackUnit, target);
                        }
                        else if (SettingsModes.LaneClear.UseQ && target.Team != GameObjectTeam.Neutral)
                        {
                            Debug.WriteChat("Casting Q, because attacking minion in Lane Clear");
                            SpellManager.Q.Cast();
                            Orbwalker.ResetAutoAttack();
                            Player.IssueOrder(GameObjectOrder.AttackUnit, target);
                        }
                    }

                }
            }
            // Item usage
            if ((SettingsModes.Combo.UseItems && Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo)) || (SettingsModes.LaneClear.UseItems && Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.LaneClear)) || (SettingsModes.JungleClear.UseItems && Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.JungleClear)))
                {
                    if (Item.HasItem(Tiamat.Id) && Tiamat.IsReady() && !target.IsDead &&
                        target.Distance(Player.Instance) < Tiamat.Range)
                    {
                        Tiamat.Cast();
                    }
                    else if (Item.HasItem(Hydra.Id) && Hydra.IsReady() && !target.IsDead &&
                             target.Distance(Player.Instance) < Hydra.Range)
                    {
                        Hydra.Cast();
                    }
                    // Cutlass/BOTRK usage
                    if(target is AIHeroClient && Item.HasItem(Cutlass.Id) && Cutlass.IsReady() && !target.IsDead &&
                             target.Distance(Player.Instance) < Cutlass.Range)
                    {
                        var spellSlot = Player.Instance.InventoryItems.FirstOrDefault(a => a.Id == Cutlass.Id);
                        Player.CastSpell(spellSlot.SpellSlot, target);
                    }
                    else if (target is AIHeroClient && Item.HasItem(BOTRK.Id) && BOTRK.IsReady() && !target.IsDead &&
                             target.Distance(Player.Instance) < BOTRK.Range && Player.Instance.HealthPercent <= 90.0f && target.HealthPercent <= 80.0f)
                    {
                        var spellSlot = Player.Instance.InventoryItems.FirstOrDefault(a => a.Id == BOTRK.Id);
                        Player.CastSpell(spellSlot.SpellSlot, target);
                    }
                }
        }
开发者ID:tramyeu,项目名称:EloBuddy,代码行数:71,代码来源:Events.cs

示例7: Orbwalker_OnPreAttack

        //---------------------------------------Orbwalker_OnPreAttack----------------------------------------

        static void Orbwalker_OnPreAttack(AttackableUnit target, Orbwalker.PreAttackArgs args)
        {
            if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo))
            {
                if (!Menu["AAMaxRange?"].Cast<CheckBox>().CurrentValue && target.Distance(Player) >= Q.Range - 30) args.Process = false;
                if (!Menu["AA?"].Cast<CheckBox>().CurrentValue) args.Process = false;
            }
        }
开发者ID:lolscripts,项目名称:wu,代码行数:10,代码来源:Program.cs


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