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


C# Vector2.InSkillShot方法代码示例

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


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

示例3: 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 = GameData.HeroInfo.ServerPos2D;

            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, GameData.HeroInfo.serverPos2D, pos);
                //Math.Min(closestDistance, GetClosestDistanceApproach(spell, pos, GameData.HeroInfo.moveSpeed, delay, GameData.HeroInfo.serverPos2D));

                if (pos.InSkillShot(spell, GameData.HeroInfo.BoundingRadius + 6)
                    || PredictSpellCollision(spell, pos, speed, delay, heroPos, extraDist, useServerPosition)
                    || (spell.Info.SpellType != SpellType.Line && pos.IsNearEnemy(ConfigValue.MinimumComfortZone.GetInt())))
                {
                    posDangerLevel = Math.Max(posDangerLevel, (int)spell.Dangerlevel);
                    posDangerCount += (int)spell.Dangerlevel;
                    undodgeableSpells.Add(spell.SpellId);
                }
                else
                {
                    dodgeableSpells.Add(spell.SpellId);
                }
            }

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

示例4: CheckMoveToDirection

        public static bool CheckMoveToDirection(Vector2 from, Vector2 movePos, float extraDelay = 0)
        {
            var dir = (movePos - from).Normalized();
            //movePos = movePos.ExtendDir(dir, ObjectCache.myHeroCache.boundingRadius);

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

                if (!from.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius))
                {
                    Vector2 spellPos = spell.currentSpellPosition;

                    if (spell.spellType == SpellType.Line)
                    {
                        if (spell.LineIntersectLinearSpell(from, movePos))
                            return true;

                    }
                    else if (spell.spellType == SpellType.Circular)
                    {
                        if (spell.info.spellName == "VeigarEventHorizon")
                        {
                            var cpa2 = MathUtilsCPA.CPAPointsEx(from, dir * ObjectCache.myHeroCache.moveSpeed, spell.endPos, new Vector2(0, 0), movePos, spell.endPos);

                            if (from.Distance(spell.endPos) < spell.radius &&
                                !(from.Distance(spell.endPos) < spell.radius - 135 &&
                                movePos.Distance(spell.endPos) < spell.radius - 135))
                            {
                                return true;
                            }
                            else if (from.Distance(spell.endPos) > spell.radius && cpa2 < spell.radius + 10)
                            {
                                return true;
                            }
                        }
                        else
                        {
                            Vector2 cHeroPos;
                            Vector2 cSpellPos;

                            var cpa2 = MathUtils.GetCollisionDistanceEx(
                                from, dir * ObjectCache.myHeroCache.moveSpeed, 1,
                                spell.endPos, new Vector2(0, 0), spell.radius,
                                out cHeroPos, out cSpellPos);

                            var cHeroPosProjection = cHeroPos.ProjectOn(from, movePos);

                            if (cHeroPosProjection.IsOnSegment && cpa2 != float.MaxValue)
                            {
                                return true;
                            }

                            /*var cpa = MathUtilsCPA.CPAPointsEx(from, dir * ObjectCache.myHeroCache.moveSpeed, spell.endPos, new Vector2(0, 0), movePos, spell.endPos);

                            if (cpa < spell.radius + 10)
                            {
                                return true;
                            }*/
                        }
                    }
                    else if (spell.spellType == SpellType.Arc)
                    {
                        if (from.isLeftOfLineSegment(spell.startPos, spell.endPos))
                        {
                            return MathUtils.CheckLineIntersection(from, movePos, spell.startPos, spell.endPos);
                        }

                        var spellRange = spell.startPos.Distance(spell.endPos);
                        var midPoint = spell.startPos + spell.direction * (spellRange / 2);

                        var cpa = MathUtilsCPA.CPAPointsEx(from, dir * ObjectCache.myHeroCache.moveSpeed, midPoint, new Vector2(0, 0), movePos, midPoint);

                        if (cpa < spell.radius + 10)
                        {
                            return true;
                        }
                    }
                    else if (spell.spellType == SpellType.Cone)
                    {

                    }
                }
            }

            return false;
        }
开发者ID:CONANLXF,项目名称:AIO,代码行数:87,代码来源:EvadeHelper.cs

示例5: GetIntersectDistance

        public static float GetIntersectDistance(Spell spell, Vector2 start, Vector2 end)
        {
            if (spell == null)
                return float.MaxValue;

            Vector3 start3D = new Vector3(start.X, start.Y, 0);
            Vector2 walkDir = (end - start);
            Vector3 walkDir3D = new Vector3(walkDir.X, walkDir.Y, 0);

            Ray heroPath = new Ray(start3D, walkDir3D);

            if (spell.spellType == SpellType.Line)
            {
                Vector2 intersection;
                bool hasIntersection = spell.LineIntersectLinearSpellEx(start, end, out intersection);
                if (hasIntersection)
                {
                    return start.Distance(intersection);
                }
            }
            else if (spell.spellType == SpellType.Circular)
            {
                if (end.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius) == false)
                {
                    Vector2 intersection1, intersection2;
                    MathUtils.FindLineCircleIntersections(spell.endPos, spell.radius, start, end, out intersection1, out intersection2);

                    if (intersection1.X != float.NaN && MathUtils.isPointOnLineSegment(intersection1, start, end))
                    {
                        return start.Distance(intersection1);
                    }
                    else if (intersection2.X != float.NaN && MathUtils.isPointOnLineSegment(intersection2, start, end))
                    {
                        return start.Distance(intersection2);
                    }
                }
            }

            return float.MaxValue;
        }
开发者ID:CONANLXF,项目名称:AIO,代码行数:40,代码来源:EvadeHelper.cs

示例6: CheckMoveToDirection

        public static bool CheckMoveToDirection(Vector2 from, Vector2 movePos, float extraDelay = 0)
        {
            var dir = (movePos - from).Normalized();
            //movePos = movePos.ExtendDir(dir, ObjectCache.myHeroCache.boundingRadius);

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

                if (!from.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius))
                {
                    Vector2 spellPos = spell.currentSpellPosition;

                    /*if (ObjectCache.menuCache.cache["AllowCrossing"].GetValue<bool>())
                    {
                        var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"].GetValue<Slider>().Value + 65;
                        var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"].GetValue<Slider>().Value + 10;

                        if (PredictSpellCollision(spell, movePos, ObjectCache.myHeroCache.moveSpeed, extraDelayBuffer, from, extraDist) == false)
                        {
                            return false;
                            Console.WriteLine("cross");
                        }
                        //continue;
                    }*/

                    if (spell.info.spellType == SpellType.Line)
                    {
                        if (spell.LineIntersectLinearSpell(from, movePos))
                            return true;

                    }
                    else if (spell.info.spellType == SpellType.Circular)
                    {
                        if (spell.info.spellName == "VeigarEventHorizon")
                        {
                            Vector2 out1, out2;

                            Vector2 perDir = dir.Perpendicular();
                            Vector2 from1 = from + perDir * ObjectCache.myHeroCache.boundingRadius;
                            Vector2 from2 = from - perDir * ObjectCache.myHeroCache.boundingRadius;
                            Vector2 to1 = movePos + perDir * ObjectCache.myHeroCache.boundingRadius;
                            Vector2 to2 = movePos - perDir * ObjectCache.myHeroCache.boundingRadius;

                            var intersections1 = MathUtils.FindLineCircleIntersections(spell.endPos, spell.radius, from1, to1, out out1, out out2);
                            var intersections2 = MathUtils.FindLineCircleIntersections(spell.endPos, spell.radius - 135, from1, to1, out out1, out out2);
                            var intersections3 = MathUtils.FindLineCircleIntersections(spell.endPos, spell.radius, from2, to2, out out1, out out2);
                            var intersections4 = MathUtils.FindLineCircleIntersections(spell.endPos, spell.radius - 135, from2, to2, out out1, out out2);

                            return !(intersections1 == 0 && intersections2 == 0
                                && intersections3 == 0 && intersections4 == 0);
                        }

                        var cpa = MathUtilsCPA.CPAPointsEx(from, dir * ObjectCache.myHeroCache.moveSpeed, spell.endPos, new Vector2(0, 0), movePos, spell.endPos);

                        if (cpa < spell.radius + 10)
                        {
                            return true;
                        }
                    }
                    else if (spell.info.spellType == SpellType.Cone)
                    {

                    }
                }
            }

            return false;
        }
开发者ID:bongy97,项目名称:LeagueSharp-1,代码行数:69,代码来源:EvadeHelper.cs

示例7: CheckMoveToDirection

        public static bool CheckMoveToDirection(Vector2 from, Vector2 movePos, float extraDelay = 0)
        {
            var dir = (movePos - from).Normalized();

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

                if (!from.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius))
                {
                    Vector2 spellPos = spell.currentSpellPosition;

                    /*if (ObjectCache.menuCache.cache["AllowCrossing"].GetValue<bool>())
                    {
                        var extraDelayBuffer = Evade.menu.Item("ExtraPingBuffer").GetValue<Slider>().Value;
                        var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"].GetValue<Slider>().Value;

                        if (PredictSpellCollision(spell, movePos, ObjectCache.myHeroCache.moveSpeed, extraDelayBuffer, from, extraDist))
                        {
                            return true;
                        }
                        Console.WriteLine("cross");
                        continue;
                    }*/

                    if (spell.info.spellType == SpellType.Line)
                    {
                        if (spell.LineIntersectLinearSpell(from, movePos))
                            return true;

                    }
                    else if (spell.info.spellType == SpellType.Circular)
                    {
                        var cpa = MathUtilsCPA.CPAPointsEx(from, dir * ObjectCache.myHeroCache.moveSpeed, spell.endPos, new Vector2(0, 0), movePos, spell.endPos);
                        if (cpa < spell.radius + 10)
                        {
                            return true;
                        }
                    }
                    else if (spell.info.spellType == SpellType.Cone)
                    {

                    }
                }
            }

            return false;
        }
开发者ID:xQxCPMxQx,项目名称:LeagueSharp-5,代码行数:48,代码来源:EvadeHelper.cs


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