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


C# Vector2.Closest方法代码示例

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


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

示例1: TryToEvade

        private static void TryToEvade(List<Skillshot> HitBy, Vector2 to)
        {
            var dangerLevel = 0;

            foreach (var skillshot in HitBy)
            {
                //dangerLevel = Math.Max(dangerLevel, skillshot.GetValue<Slider>("DangerLevel").Value);
            }

            foreach (var evadeSpell in EvadeSpellDatabase.Spells)
            {
                if (evadeSpell.Enabled && evadeSpell.DangerLevel <= dangerLevel)
                {
                    //SpellShields
                    if (evadeSpell.IsSpellShield &&
                        ObjectManager.Player.Spellbook.CanUseSpell(evadeSpell.Slot) == SpellState.Ready)
                    {
                        if (IsAboutToHit(ObjectManager.Player, evadeSpell.Delay))
                        {
                            ObjectManager.Player.Spellbook.CastSpell(evadeSpell.Slot, ObjectManager.Player);
                        }
                        //Let the user move freely inside the skillshot.
                        NoSolutionFound = true;
                        return;
                    }

                    //Walking
                    if (evadeSpell.Name == "Walking")
                    {
                        var points = Evader.GetEvadePoints();
                        if (points.Count > 0)
                        {
                            EvadePoint = to.Closest(points);
                            var nEvadePoint = EvadePoint.LSExtend(PlayerPosition, -100);
                            if (
                                Program.IsSafePath(
                                    ObjectManager.Player.GetPath(nEvadePoint.To3D()).To2DList(),
                                    Config.EvadingSecondTimeOffset, (int) ObjectManager.Player.MoveSpeed, 100).IsSafe)
                            {
                                EvadePoint = nEvadePoint;
                            }

                            Evading = true;
                            return;
                        }
                    }

                    if (evadeSpell.IsReady())
                    {
                        //MovementSpeed Buff
                        if (evadeSpell.IsMovementSpeedBuff)
                        {
                            var points = Evader.GetEvadePoints((int) evadeSpell.MoveSpeedTotalAmount());

                            if (points.Count > 0)
                            {
                                EvadePoint = to.Closest(points);
                                Evading = true;

                                if (evadeSpell.IsSummonerSpell)
                                {
                                  //  ObjectManager.Player.Spellbook.CastSpell(
                                      //  evadeSpell.Slot, ObjectManager.Player);
                                }
                                else
                                {
                                    //ObjectManager.Player.Spellbook.CastSpell(evadeSpell.Slot, ObjectManager.Player);
                                }

                                return;
                            }
                        }

                        //Dashes
                        if (evadeSpell.IsDash)
                        {
                            //Targetted dashes
                            if (evadeSpell.IsTargetted) //Lesinga W.
                            {
                                var targets = Evader.GetEvadeTargets(
                                    evadeSpell.ValidTargets, evadeSpell.Speed, evadeSpell.Delay, evadeSpell.MaxRange,
                                    false, false);

                                if (targets.Count > 0)
                                {
                                    var closestTarget = Utils.Closest(targets, to);
                                    EvadePoint = closestTarget.ServerPosition.LSTo2D();
                                    Evading = true;

                                    if (evadeSpell.IsSummonerSpell)
                                    {
                                        ObjectManager.Player.Spellbook.CastSpell(evadeSpell.Slot, closestTarget);
                                    }
                                    else
                                    {
                                        ObjectManager.Player.Spellbook.CastSpell(evadeSpell.Slot, closestTarget);
                                    }

                                    return;
                                }
//.........这里部分代码省略.........
开发者ID:yashine59fr,项目名称:PortAIO-1,代码行数:101,代码来源:Program.cs

示例2: Game_OnGameSendPacket

        /// <summary>
        /// Used to block the movement to avoid entering in dangerous areas.
        /// </summary>
        private static void Game_OnGameSendPacket(GamePacketEventArgs args)
        {
            //Move Packet
            if (args.PacketData[0] == Packet.C2S.Move.Header)
            {
                CutPathPoint = new Vector2();
                //Don't block the movement packets if cant find an evade point.
                if (NoSolutionFound)
                {
                    return;
                }

                //Evading disabled
                if (!Config.Menu.Item("Enabled").GetValue<KeyBind>().Active)
                {
                    return;
                }

                //Spell Shielded
                if (IsSpellShielded(ObjectManager.Player))
                {
                    return;
                }

                var decodedPacket = Packet.C2S.Move.Decoded(args.PacketData);

                if(decodedPacket.UnitNetworkId != ObjectManager.Player.NetworkId) return;

                if (decodedPacket.MoveType == 2)
                {
                    EvadeToPoint.X = decodedPacket.X;
                    EvadeToPoint.Y = decodedPacket.Y;
                }

                var myPath =
                    ObjectManager.Player.GetPath(
                        new Vector3(decodedPacket.X, decodedPacket.Y, ObjectManager.Player.ServerPosition.Z)).To2DList();
                var safeResult = IsSafe(ObjectManager.Player.ServerPosition.To2D());
                var safePath = IsSafePath(myPath, Config.EvadingRouteChangeTimeOffset);

                //If we are evading:
                if (Evading || !safeResult.IsSafe)
                {
                    if (decodedPacket.MoveType == 2)
                    {
                        AfterEvadePoint = new Vector2(decodedPacket.X, decodedPacket.Y);
                        if (Evading &&
                            Environment.TickCount - Config.LastEvadePointChangeT > Config.EvadePointChangeInterval)
                        {
                            //Update the evade point to the closest one:
                            var points = Evader.GetEvadePoints(-1, 0, false, true);
                            if (points.Count > 0)
                            {
                                var to = new Vector2(decodedPacket.X, decodedPacket.Y);
                                EvadePoint = to.Closest(points);
                                Evading = true;
                                Config.LastEvadePointChangeT = Environment.TickCount;
                            }
                        }

                        //If the path is safe let the user follow it.
                        if (safePath.IsSafe && IsSafe(myPath[myPath.Count - 1]).IsSafe && decodedPacket.MoveType == 2)
                        {
                            EvadePoint = myPath[myPath.Count - 1];
                            Evading = true;
                        }

                        CutPathPoint = new Vector2(decodedPacket.X, decodedPacket.Y);
                    }

                    //Block the packets if we are evading or not safe.
                    args.Process = false;
                    return;
                }

                //Not evading, outside the skillshots.
                //The path is not safe, stop in the intersection point.
                if (!safePath.IsSafe && decodedPacket.MoveType != 3)
                {
                    if (safePath.Intersection.Valid)
                    {
                        ObjectManager.Player.SendMovePacket(safePath.Intersection.Point);
                    }
                    CutPathPoint = new Vector2(decodedPacket.X, decodedPacket.Y);
                    args.Process = false;
                }

                //AutoAttacks.
                if (!safePath.IsSafe && decodedPacket.MoveType == 3)
                {
                    var target = ObjectManager.GetUnitByNetworkId<Obj_AI_Base>(decodedPacket.TargetNetworkId);
                    if (target != null && target.IsValid && target.IsVisible)
                    {
                        //Out of attack range.
                        if (ObjectManager.Player.ServerPosition.To2D().Distance(target.ServerPosition) >
                            ObjectManager.Player.AttackRange + ObjectManager.Player.BoundingRadius +
                            target.BoundingRadius)
//.........这里部分代码省略.........
开发者ID:Chogart,项目名称:LeagueSharp-2,代码行数:101,代码来源:Program.cs

示例3: ObjAiHeroOnOnIssueOrder

        /// <summary>
        /// Used to block the movement to avoid entering in dangerous areas.
        /// </summary>
        /// 
        private static void ObjAiHeroOnOnIssueOrder(Obj_AI_Base sender, PlayerIssueOrderEventArgs args)
        {
            if (!sender.IsMe)
            {
                return;
            }

            //Don't block the movement packets if cant find an evade point.
            if (NoSolutionFound)
            {
                return;
            }

            //Spell Shielded
            if (ObjectManager.Player.IsSpellShielded())
            {
                return;
            }

            if (args.Order == GameObjectOrder.MoveTo || args.Order == GameObjectOrder.AttackTo)
            {
                EvadeToPoint.X = args.TargetPosition.X;
                EvadeToPoint.Y = args.TargetPosition.Y;
                Keepfollowing = false;
                FollowPath = false;
            }
            else
            {
                EvadeToPoint.X = 0;
                EvadeToPoint.Y = 0;
            }

            var myPath =
                ObjectManager.Player.GetPath(
                    new Vector3(args.TargetPosition.X, args.TargetPosition.Y, ObjectManager.Player.ServerPosition.Z)).To2DList();
            var safeResult = IsSafe(PlayerPosition);

            //If we are evading:
            if (Evading || !safeResult.IsSafe)
            {
                var rcSafePath = IsSafePath(myPath, Config.EvadingRouteChangeTimeOffset);
                if (args.Order == GameObjectOrder.MoveTo)
                {
                    if (Evading &&
                        Utils.TickCount - Config.LastEvadePointChangeT > Config.EvadePointChangeInterval)
                    {
                        //Update the evade point to the closest one:
                        var points = Evader.GetEvadePoints(-1, 0, false, true);
                        if (points.Count > 0)
                        {
                            var to = new Vector2(args.TargetPosition.X, args.TargetPosition.Y);
                            EvadePoint = to.Closest(points);
                            Evading = true;
                            Config.LastEvadePointChangeT = Utils.TickCount;
                        }
                    }

                    //If the path is safe let the user follow it.
                    if (rcSafePath.IsSafe && IsSafe(myPath[myPath.Count - 1]).IsSafe && args.Order == GameObjectOrder.MoveTo)
                    {
                        EvadePoint = myPath[myPath.Count - 1];
                        Evading = true;
                    }
                }

                //Block the packets if we are evading or not safe.
                args.Process = false;
                return;
            }

            var safePath = IsSafePath(myPath, Config.CrossingTimeOffset);

            //Not evading, outside the skillshots.
            //The path is not safe, stop in the intersection point.
            if (!safePath.IsSafe && args.Order != GameObjectOrder.AttackUnit)
            {
                if (safePath.Intersection.Valid)
                {
                    if (ObjectManager.Player.LSDistance(safePath.Intersection.Point) > 75)
                    {
                        ObjectManager.Player.SendMovePacket(safePath.Intersection.Point);
                    }
                }
                FollowPath = true;
                args.Process = false;
            }
            else if(safePath.IsSafe && args.Order != GameObjectOrder.AttackUnit)
            {
                FollowPath = false;
            }

            //AutoAttacks.
            if (!safePath.IsSafe && args.Order == GameObjectOrder.AttackUnit)
            {
                var target = args.Target;
                if (target != null && target.IsValid<Obj_AI_Base>() && target.IsVisible)
//.........这里部分代码省略.........
开发者ID:yashine59fr,项目名称:PortAIO-1,代码行数:101,代码来源:Program.cs

示例4: ObjAiHeroOnOnIssueOrder

        /// <summary>
        /// Used to block the movement to avoid entering in dangerous areas.
        /// </summary>
        /// 
        private static void ObjAiHeroOnOnIssueOrder(Obj_AI_Base sender, GameObjectIssueOrderEventArgs args)
        {
            if (!sender.IsMe)
            {
                return;
            }

            //Don't block the movement packets if cant find an evade point.
            if (NoSolutionFound)
            {
                return;
            }

            //Evading disabled
            if (!Config.Menu.Item("Enabled").GetValue<KeyBind>().Active)
            {
                return;
            }

            //Spell Shielded
            if (IsSpellShielded(ObjectManager.Player))
            {
                return;
            }

            if (args.Order == GameObjectOrder.MoveTo)
            {
                EvadeToPoint.X = args.TargetPosition.X;
                EvadeToPoint.Y = args.TargetPosition.Y;
            }
            else
            {
                EvadeToPoint.X = 0;
                EvadeToPoint.Y = 0;
            }
            
            var myPath =
                ObjectManager.Player.GetPath(
                    new Vector3(args.TargetPosition.X, args.TargetPosition.Y, ObjectManager.Player.ServerPosition.Z)).To2DList();
            var safeResult = IsSafe(ObjectManager.Player.ServerPosition.To2D());


            //If we are evading:
            if (Evading || !safeResult.IsSafe)
            {
                var rcSafePath = IsSafePath(myPath, Config.EvadingRouteChangeTimeOffset);
                if (args.Order == GameObjectOrder.MoveTo)
                {
                    if (Evading &&
                        Utils.TickCount - Config.LastEvadePointChangeT > Config.EvadePointChangeInterval)
                    {
                        //Update the evade point to the closest one:
                        var points = Evader.GetEvadePoints(-1, 0, false, true);
                        if (points.Count > 0)
                        {
                            var to = new Vector2(args.TargetPosition.X, args.TargetPosition.Y);
                            EvadePoint = to.Closest(points);
                            Evading = true;
                            Config.LastEvadePointChangeT = Utils.TickCount;
                        }
                    }

                    //If the path is safe let the user follow it.
                    if (rcSafePath.IsSafe && IsSafe(myPath[myPath.Count - 1]).IsSafe && args.Order == GameObjectOrder.MoveTo)
                    {
                        EvadePoint = myPath[myPath.Count - 1];
                        Evading = true;
                    }
                }

                //Block the packets if we are evading or not safe.
                args.Process = false;
                return;
            }

            var safePath = IsSafePath(myPath, Config.CrossingTimeOffset);

            //Not evading, outside the skillshots.
            //The path is not safe, stop in the intersection point.
            if (!safePath.IsSafe && args.Order != GameObjectOrder.AttackUnit)
            {
                if (safePath.Intersection.Valid)
                {
                    if (ObjectManager.Player.Distance(safePath.Intersection.Point) > 75)
                    {
                        ObjectManager.Player.SendMovePacket(safePath.Intersection.Point);
                    }
                    else
                    {
                        if (/*DetectedSkillshots.Count == 1 &&*/ Utils.TickCount - lastSMovePacketT > 400)
                        {
                            lastSMovePacketT = Utils.TickCount;

                            var perpendicular =
                                (ObjectManager.Player.ServerPosition.To2D() - safePath.Intersection.Point)
                                    .Normalized();
//.........这里部分代码省略.........
开发者ID:Deprive,项目名称:Private,代码行数:101,代码来源:Evade.cs

示例5: Game_OnGameSendPacket

        /// <summary>
        /// Used to block the movement to avoid entering in dangerous areas.
        /// </summary>
        private static void Game_OnGameSendPacket(GamePacketEventArgs args)
        {
            //Move Packet
            if (args.PacketData[0] == Packet.C2S.Move.Header)
            {
                //Don't block the movement packets if cant find an evade point.
                if (NoSolutionFound)
                {
                    return;
                }

                //Evading disabled
                if (!Config.Menu.Item("Enabled").GetValue<KeyBind>().Active)
                {
                    return;
                }

                if (EvadeSpellDatabase.Spells.Any(evadeSpell => evadeSpell.Name == "Walking" && !evadeSpell.Enabled))
                {
                    return;
                }

                //Spell Shielded
                if (IsSpellShielded(ObjectManager.Player))
                {
                    return;
                }

                var decodedPacket = Packet.C2S.Move.Decoded(args.PacketData);

                if(decodedPacket.UnitNetworkId != ObjectManager.Player.NetworkId) return;

                if (decodedPacket.MoveType == 2)
                {
                    EvadeToPoint.X = decodedPacket.X;
                    EvadeToPoint.Y = decodedPacket.Y;
                }
                else
                {
                    EvadeToPoint.X = 0;
                    EvadeToPoint.Y = 0;
                }

                var myPath =
                    ObjectManager.Player.GetPath(
                        new Vector3(decodedPacket.X, decodedPacket.Y, ObjectManager.Player.ServerPosition.Z)).To2DList();
                var safeResult = IsSafe(ObjectManager.Player.ServerPosition.To2D());

                //If we are evading:
                if (Evading || !safeResult.IsSafe)
                {
                    var rcSafePath = IsSafePath(myPath, Config.EvadingRouteChangeTimeOffset);
                    if (decodedPacket.MoveType == 2)
                    {
                        if (Evading &&
                            Environment.TickCount - Config.LastEvadePointChangeT > Config.EvadePointChangeInterval)
                        {
                            //Update the evade point to the closest one:
                            var points = Evader.GetEvadePoints(-1, 0, false, true);
                            if (points.Count > 0)
                            {
                                var to = new Vector2(decodedPacket.X, decodedPacket.Y);
                                EvadePoint = to.Closest(points);
                                Evading = true;
                                Config.LastEvadePointChangeT = Environment.TickCount;
                            }
                        }

                        //If the path is safe let the user follow it.
                        if (rcSafePath.IsSafe && IsSafe(myPath[myPath.Count - 1]).IsSafe && decodedPacket.MoveType == 2)
                        {
                            EvadePoint = myPath[myPath.Count - 1];
                            Evading = true;
                        }
                    }

                    //Block the packets if we are evading or not safe.
                    args.Process = false;
                    return;
                }

                var safePath = IsSafePath(myPath, Config.CrossingTimeOffset);

                //Not evading, outside the skillshots.
                //The path is not safe, stop in the intersection point.
                if (!safePath.IsSafe && decodedPacket.MoveType != 3)
                {
                    if (safePath.Intersection.Valid)
                    {
                        if (ObjectManager.Player.Distance(safePath.Intersection.Point) > 75)
                        {
                            ObjectManager.Player.SendMovePacket(safePath.Intersection.Point);
                        }
                        else
                        {
                            if (/*DetectedSkillshots.Count == 1 &&*/ Environment.TickCount - LastSMovePacketT > 400)
                            {
//.........这里部分代码省略.........
开发者ID:guskate,项目名称:LeagueSharp,代码行数:101,代码来源:Program.cs

示例6: TryToEvade

        private static void TryToEvade(List<Skillshot> HitBy, Vector2 to)
        {
            var dangerLevel = 0;

            foreach (var skillshot in HitBy)
            {
                dangerLevel = Math.Max(dangerLevel, skillshot.GetValue<Slider>("DangerLevel").Value);
            }

            foreach (var evadeSpell in EvadeSpellDatabase.Spells)
            {
                if (evadeSpell.Enabled && evadeSpell.DangerLevel <= dangerLevel)
                {
                    //SpellShields
                    if (evadeSpell.IsSpellShield &&
                        ObjectManager.Player.Spellbook.CanUseSpell(evadeSpell.Slot) == SpellState.Ready)
                    {
                        if (IsAboutToHit(ObjectManager.Player, evadeSpell.Delay))
                        {
                            ObjectManager.Player.Spellbook.CastSpell(evadeSpell.Slot, EvadePoint.To3D());
                        }

                        //Let the user move freely inside the skillshot.
                        NoSolutionFound = true;
                        return;
                    }

                    //Walking
                    if (evadeSpell.Name == "Walking")
                    {
                        var points = Evader.GetEvadePoints();
                        if (points.Count > 0)
                        {
                            EvadePoint = to.Closest(points);
                            Evading = true;
                            return;
                        }
                    }

                    if ((evadeSpell.CheckSpellName == "" ||
                         ObjectManager.Player.Spellbook.GetSpell(evadeSpell.Slot).Name == evadeSpell.CheckSpellName) &&
                        ((evadeSpell.IsSummonerSpell &&
                          ObjectManager.Player.SummonerSpellbook.CanUseSpell(evadeSpell.Slot) == SpellState.Ready) ||
                         (!evadeSpell.IsSummonerSpell &&
                          ObjectManager.Player.Spellbook.CanUseSpell(evadeSpell.Slot) == SpellState.Ready)))
                    {
                        //Dashes
                        if (evadeSpell.IsDash)
                        {
                            //Targetted dashes
                            if (evadeSpell.IsTargetted)//Lesinga W.
                            {
                                //Todo.
                            }

                                //Skillshot type dashes.
                            else
                            {
                                var points = Evader.GetEvadePoints(evadeSpell.Speed, evadeSpell.Delay, false);

                                // Remove the points out of range
                                points.RemoveAll(
                                    item => item.Distance(ObjectManager.Player.ServerPosition) > evadeSpell.MaxRange);

                                //If the spell has a fixed range (Vaynes Q), calculate the real dashing location. TODO: take into account walls in the future.
                                if (evadeSpell.FixedRange)
                                {
                                    for (var i = 0; i < points.Count; i++)
                                    {
                                        points[i] = ObjectManager.Player.ServerPosition.To2D() +
                                                    evadeSpell.MaxRange*
                                                    (points[i] - ObjectManager.Player.ServerPosition.To2D()).Normalized();
                                    }
                                }

                                if (points.Count > 0)
                                {
                                    EvadePoint = to.Closest(points);
                                    Evading = true;

                                    if (!evadeSpell.Invert)
                                    {
                                        if (evadeSpell.RequiresPreMove)
                                        {
                                            ObjectManager.Player.SendMovePacket(EvadePoint);
                                            var theSpell = evadeSpell;
                                            Utility.DelayAction.Add(Game.Ping/2 + 100, delegate
                                            {
                                                ObjectManager.Player.Spellbook.CastSpell(theSpell.Slot, EvadePoint.To3D());
                                            });
                                        }
                                        else
                                        {
                                            ObjectManager.Player.Spellbook.CastSpell(evadeSpell.Slot, EvadePoint.To3D());
                                        }
                                    }
                                    else
                                    {
                                        var castPoint = ObjectManager.Player.ServerPosition.To2D() -
                                                        (EvadePoint - ObjectManager.Player.ServerPosition.To2D());
//.........这里部分代码省略.........
开发者ID:JizzHub,项目名称:LeagueSharp,代码行数:101,代码来源:Program.cs

示例7: ObjAiHeroOnOnIssueOrder

        /// <summary>
        /// Used to block the movement to avoid entering in dangerous areas.
        /// </summary>
        /// 
        private static void ObjAiHeroOnOnIssueOrder(Obj_AI_Base sender, PlayerIssueOrderEventArgs args)
        {
            if (!sender.IsMe)
            {
                return;
            }

            //Don't block the movement packets if cant find an evade point.
            if (NoSolutionFound)
            {
                return;
            }

            //Evading disabled
            if (!Config.Menu["Enabled"].Cast<KeyBind>().CurrentValue)
            {
                return;
            }

            if (EvadeSpellDatabase.Spells.Any(evadeSpell => evadeSpell.Name == "Walking" && !evadeSpell.Enabled))
            {
                return;
            }

            //Spell Shielded
            if (ObjectManager.Player.MagicShield > 0)
            {
                return;
            }

            if (PlayerChampionName == "Olaf" && Config.misc["DisableEvadeForOlafR"].Cast<CheckBox>().CurrentValue && ObjectManager.Player.HasBuff("OlafRagnarok"))
            {
                return;
            }

            if (args.Order == GameObjectOrder.MoveTo || args.Order == GameObjectOrder.AttackTo)
            {
                EvadeToPoint.X = args.TargetPosition.X;
                EvadeToPoint.Y = args.TargetPosition.Y;
                Keepfollowing = false;
                FollowPath = false;
            }
            else
            {
                EvadeToPoint.X = 0;
                EvadeToPoint.Y = 0;
            }

            var myPath =
                ObjectManager.Player.GetPath(
                    new Vector3(args.TargetPosition.X, args.TargetPosition.Y, ObjectManager.Player.ServerPosition.Z)).To2DList();
            var safeResult = IsSafe(PlayerPosition);

            // Check for the unnessasary moving
            if (Evading || safeResult.IsSafe)
            {
                Evading = false;
                NoSolutionFound = true;
            }

            //If we are evading:
            if (Evading || !safeResult.IsSafe)
            {
                var rcSafePath = IsSafePath(myPath, Config.EvadingRouteChangeTimeOffset);
                if (args.Order == GameObjectOrder.MoveTo)
                {
                    if (Evading &&
                        Utils.TickCount - Config.LastEvadePointChangeT > Config.EvadePointChangeInterval)
                    {
                        //Update the evade point to the closest one:
                        var points = Evader.GetEvadePoints(-1, 0, false, true);
                        if (points.Count > 0)
                        {
                            var to = new Vector2(args.TargetPosition.X, args.TargetPosition.Y);
                            EvadePoint = to.Closest(points);
                            Evading = true;
                            Config.LastEvadePointChangeT = Utils.TickCount;
                        }
                    }

                    //If the path is safe let the user follow it.
                    if (rcSafePath.IsSafe && IsSafe(myPath[myPath.Count - 1]).IsSafe && args.Order == GameObjectOrder.MoveTo)
                    {
                        EvadePoint = myPath[myPath.Count - 1];
                        Evading = true;
                    }
                }

                //Block the packets if we are evading or not safe.
                args.Process = false;
                return;
            }

            var safePath = IsSafePath(myPath, Config.CrossingTimeOffset);

            //Not evading, outside the skillshots.
//.........这里部分代码省略.........
开发者ID:ReSrReCTion,项目名称:elobuddy,代码行数:101,代码来源:Program.cs

示例8: TryToEvade

            private static void TryToEvade(List<Skillshot> hitBy, Vector2 to)
            {
                var dangerLevel =
                    hitBy.Select(i => Manager.MenuManager.EDLVL.Cast<Slider>().CurrentValue) //championmenu["DangerLevel"].Cast<Slider>().CurrentValue
                        .Concat(new[] { 0 })
                        .Max();
                foreach (var evadeSpell in
                    EvadeSpellDatabase.Spells.Where(i => i.Enabled && i.DangerLevel <= dangerLevel && i.IsReady)
                        .OrderBy(i => i.DangerLevel))
                {
                    if (evadeSpell.EvadeType == EvadeTypes.Dash && evadeSpell.CastType == CastTypes.Target)
                    {
                        var targets =
                            GetEvadeTargets(evadeSpell)
                                .Where(
                                    i =>
                                    IsSafePoint(Extensions.PosAfterE(i).To2D()).IsSafe
                                    && (!Extensions.PosAfterE(i).IsUnderTurret()) || Manager.MenuManager.EvadeMenu["ETower"].Cast<CheckBox>().CurrentValue)
                                .ToList();
                        if (targets.Count > 0)
                        {
                            var closestTarget = targets.MinOrDefault(i => Extensions.PosAfterE(i).To2D().Distance(to));
                            ObjectManager.Player.Spellbook.CastSpell(evadeSpell.Slot, closestTarget);
                            return;
                        }
                    }
                    if (evadeSpell.EvadeType == EvadeTypes.WindWall
                        && hitBy.Where(
                            i =>
                            i.SpellData.CollisionObjects.Contains(CollisionObjectTypes.YasuoWall)
                            && i.IsAboutToHit(
                                150 + evadeSpell.Delay - Manager.MenuManager.EvadeMenu["WDelay"].Cast<Slider>().CurrentValue,
                                ObjectManager.Player))
                               .OrderByDescending(
                                   i => Manager.MenuManager.EDLVL.Cast<Slider>().CurrentValue)
                               .Any(
                                   i =>
                                   ObjectManager.Player.Spellbook.CastSpell(
                                       evadeSpell.Slot,
                                       ObjectManager.Player.ServerPosition.Extend(i.Start.To3D(), 100).To3D(), true)))
                    {
                        return;
                    }
                    if (evadeSpell.EvadeType == EvadeTypes.Dash && evadeSpell.CastType == CastTypes.Position)
                    {
                        var points = GetEvadePoints(evadeSpell.Speed, evadeSpell.Delay, false);

                        points.RemoveAll(
                            item => item.Distance(ObjectManager.Player.ServerPosition) > evadeSpell.MaxRange);

                        if (evadeSpell.FixedRange)
                        {
                            for (var i = 0; i < points.Count; i++)
                            {
                                points[i] = ObjectManager.Player.Position
                                    .Extend(points[i], evadeSpell.MaxRange);
                            }

                            for (var i = points.Count - 1; i > 0; i--)
                            {
                                if (!IsSafePoint(points[i]).IsSafe)
                                {
                                    points.RemoveAt(i);
                                }
                            }
                        }

                        if (points.Count > 0)
                        {
                            var EvadePoint = to.Closest(points);

                            var castPoint = ObjectManager.Player.Position -
                                            (EvadePoint.To3D() - ObjectManager.Player.Position);
                            ObjectManager.Player.Spellbook.CastSpell(evadeSpell.Slot, castPoint);
                        }

                        return;
                    }
                }
            }
开发者ID:Kysamaa,项目名称:EloBuddy,代码行数:80,代码来源:EvadeManager.cs


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