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


C# Vector2.isNearEnemy方法代码示例

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


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

示例1: CanHeroWalkToPos

        public static PositionInfo CanHeroWalkToPos(Vector2 pos, float speed, float delay, float extraDist, bool useServerPosition = true)
        {
            int posDangerLevel = 0;
            int posDangerCount = 0;
            float closestDistance = float.MaxValue;
            List<int> dodgeableSpells = new List<int>();
            List<int> undodgeableSpells = new List<int>();

            Vector2 heroPos = ObjectCache.myHeroCache.serverPos2D;

            var minComfortDistance = ObjectCache.menuCache.cache["MinComfortZone"].Cast<Slider>().CurrentValue;

            if (useServerPosition == false)
            {
                heroPos = myHero.Position.LSTo2D();
            }

            foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells)
            {
                Spell spell = entry.Value;

                var moveBuff = EvadeSpell.evadeSpells.OrderBy(s => s.dangerlevel).FirstOrDefault(s => s.evadeType == EvadeType.MovementSpeedBuff);
                if (moveBuff != null && EvadeSpell.ShouldUseMovementBuff(spell))
                {
                    speed += speed * moveBuff.speedArray[myHero.GetSpell(moveBuff.spellKey).Level - 1] / 100;
                }

                closestDistance = Math.Min(closestDistance, GetClosestDistanceApproach(spell, pos, speed, delay, heroPos, extraDist));

                if (pos.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius - 6)
                    || PredictSpellCollision(spell, pos, speed, delay, heroPos, extraDist, useServerPosition)
                    || (spell.info.spellType != SpellType.Line && pos.isNearEnemy(minComfortDistance)))
                {
                    posDangerLevel = Math.Max(posDangerLevel, spell.dangerlevel);
                    posDangerCount += spell.dangerlevel;
                    undodgeableSpells.Add(spell.spellID);
                }
                else
                {
                    dodgeableSpells.Add(spell.spellID);
                }
            }

            return new PositionInfo(
                pos,
                posDangerLevel,
                posDangerCount,
                posDangerCount > 0,
                closestDistance,
                dodgeableSpells,
                undodgeableSpells);
        }
开发者ID:CainWolf,项目名称:PortAIO,代码行数:52,代码来源:EvadeHelper.cs

示例2: CanHeroWalkToPos

        public static PositionInfo CanHeroWalkToPos(Vector2 pos, float speed, float delay, float extraDist, bool useServerPosition = true)
        {
            int posDangerLevel = 0;
            int posDangerCount = 0;
            float closestDistance = float.MaxValue;
            List<int> dodgeableSpells = new List<int>();
            List<int> undodgeableSpells = new List<int>();

            Vector2 heroPos = ObjectCache.myHeroCache.serverPos2D;

            var minComfortDistance = ObjectCache.menuCache.cache["MinComfortZone"].GetValue<Slider>().Value;

            if (useServerPosition == false)
            {
                heroPos = myHero.Position.To2D();
            }

            foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells)
            {
                Spell spell = entry.Value;

                closestDistance = Math.Min(closestDistance, GetClosestDistanceApproach(spell, pos, speed, delay, heroPos, extraDist));
                //GetIntersectTime(spell, ObjectCache.myHeroCache.serverPos2D, pos);
                //Math.Min(closestDistance, GetClosestDistanceApproach(spell, pos, ObjectCache.myHeroCache.moveSpeed, delay, ObjectCache.myHeroCache.serverPos2D));

                if (pos.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius + 6)
                    || PredictSpellCollision(spell, pos, speed, delay, heroPos, extraDist)
                    || pos.IsUnderTurret()
                    || (spell.info.spellType != SpellType.Line && pos.isNearEnemy(minComfortDistance)))
                {
                    posDangerLevel = Math.Max(posDangerLevel, spell.dangerlevel);
                    posDangerCount += spell.dangerlevel;
                    undodgeableSpells.Add(spell.spellID);
                }
                else
                {
                    dodgeableSpells.Add(spell.spellID);
                }
            }

            return new PositionInfo(
                pos,
                posDangerLevel,
                posDangerCount,
                posDangerCount > 0,
                closestDistance,
                dodgeableSpells,
                undodgeableSpells);
        }
开发者ID:bongy97,项目名称:LeagueSharp-1,代码行数:49,代码来源:EvadeHelper.cs


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