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


C# Vector2.Extend方法代码示例

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


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

示例1: GetFirstNonWallPos

 public static Vector2 GetFirstNonWallPos(Vector2 startPos, Vector2 endPos)
 {
     int distance = 0;
     for (int i = 0; i < Program.CondemnMenu["pushDistance"].Cast<Slider>().CurrentValue; i += 20)
     {
         var cell = startPos.Extend(endPos, endPos.Distance(startPos) + i).ToNavMeshCell().CollFlags;
         if (cell.HasFlag(CollisionFlags.Wall) || cell.HasFlag(CollisionFlags.Building))
         {
             distance = i - 20;
         }
     }
     return startPos.Extend(endPos, distance + endPos.Distance(startPos));
 }
开发者ID:hup3s,项目名称:Elobuddy-Addons,代码行数:13,代码来源:Condemn.cs

示例2: GetFirstNonWallPos

 public static Vector2 GetFirstNonWallPos(Vector2 startPos, Vector2 endPos)
 {
     int distance = 0;
     for (int i = 0; i < Manager.MenuManager.CondemnPushDistance; i += 20)
     {
         var cell = startPos.Extend(endPos, endPos.Distance(startPos) + i);
         if (NavMesh.GetCollisionFlags(cell).HasFlag(CollisionFlags.Wall) ||
             NavMesh.GetCollisionFlags(cell).HasFlag(CollisionFlags.Building))
         {
             distance = i - 20;
         }
     }
     return startPos.Extend(endPos, distance + endPos.Distance(startPos));
 }
开发者ID:Kysamaa,项目名称:EloBuddy,代码行数:14,代码来源:Mechanics.cs

示例3: GetCondemnPosition

        public static Vector3 GetCondemnPosition(this Vector3 position)
        {
            var pointList = new List<Vector3>();

            pointList.Add(Vector3.Zero);

            for (var j = 485; j >= 50; j -= 100)
            {
                var offset = (int)(2 * Math.PI * j / 100);

                for (var i = 0; i <= offset; i++)
                {
                    var angle = i * Math.PI * 2 / offset;
                    var point =
                        new Vector2(
                            (float)(position.X + j * Math.Cos(angle)),
                            (float)(position.Y - j * Math.Sin(angle))).To3D();

                    var cP = point.Extend(position, point.Distance(position) + 50);
                    if (point.IsWall() && cP.Distance(point) < 425 && !cP.UnderTurret(true) && cP.Distance(position) > 325 && cP.Distance(position) < 545 &&
                 (cP.CountEnemiesInRange(425) <= cP.CountAlliesInRange(325)))
                    {
                        pointList.Add(cP);
                    }
                }
            }

            return pointList.OrderByDescending(p=>p.Distance(position)).FirstOrDefault();
        }
开发者ID:Hydro202,项目名称:Leaguesharp,代码行数:29,代码来源:Extensions.cs

示例4: Insec

 public static void Insec(Obj_AI_Hero target)
 {
     Rpos = Player.Position.To2D().Extend(target.Position.To2D(), Player.Distance(target) + 250);
     if (Rpos.Distance(Player.Position) <= R.Range)
     {
         if (Player.Distance(Rpos.Extend(target.Position.To2D(), 700 - target.Distance(Rpos))) < E.Range && !IsWall(Rpos.To3D()) && target.IsFacing(Player))
         {
             R.Cast(Rpos);
         }
     }
 }
开发者ID:xcxooxl,项目名称:Lsharp3,代码行数:11,代码来源:Gragas.cs

示例5: InMiddileWall

 public static bool InMiddileWall(Vector2 firstwall, Vector2 lastwall)
 {
     var midwall = new Vector2((firstwall.X + lastwall.X) / 2, (firstwall.Y + lastwall.Y) / 2);
     var point = midwall.Extend(Game.CursorPos.To2D(), 50);
     for (int i = 0; i <= 350; i = i + 10)
     {
         var testpoint = point.BadaoRotateAround(midwall, i);
         var flags = NavMesh.GetCollisionFlags(testpoint.X, testpoint.Y);
         if (!flags.HasFlag(CollisionFlags.Wall) && !flags.HasFlag(CollisionFlags.Building))
         {
             return false;
         }
     }
     return true;
 }
开发者ID:badao,项目名称:BadaoKingdomTest,代码行数:15,代码来源:BadaoMath.cs

示例6: IsCondemable

        public static bool IsCondemable(this AIHeroClient unit, Vector2 pos = new Vector2())
        {
            if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) || LastCheck + 50 > Environment.TickCount || _Player.IsDashing()) return false;
            Program.CorrectPoints = new List<Vector2>();
            Program.Points = new List<Vector2>();
            if (!pos.IsValid()) pos = ObjectManager.Player.Position.To2D();
            int wallCount = 0;
            int pushDistance = Program.CondemnMenu["pushDistance"].Cast<Slider>().CurrentValue;

            for (int i = 0; i < pushDistance; i += 20)
            {
                var unitPos = Prediction.Position.PredictUnitPosition(unit, 250);
                var cell = pos.Extend(unitPos, unitPos.Distance(pos) + i);
                if (cell.ToNavMeshCell().CollFlags.HasFlag(CollisionFlags.Wall))
                {
                    Program.CorrectPoints.Add(cell);
                    wallCount++;
                }
                else
                {
                    Program.Points.Add(cell);
                }
            }

            if (CheckCount >= 2 && wallCount > 2)
            {
                CheckCount = 0;
                LastCheck = Environment.TickCount;
                return true;
            }

            if (wallCount > 2)
            {
                CheckCount++;
            }
            else
            {
                CheckCount = 0;
            }
            LastCheck = Environment.TickCount;
            return false;
        }
开发者ID:hup3s,项目名称:Elobuddy-Addons,代码行数:42,代码来源:Condemn.cs

示例7: willColide

 public static bool willColide(Skillshot ss, Vector2 from, float speed, Vector2 direction, float radius)
 {
     Vector2 ssVel = ss.Direction.Normalized() * ss.SpellData.MissileSpeed;
     Vector2 dashVel = direction * speed;
     Vector2 a = ssVel - dashVel;
     Vector2 realFrom = from.Extend(direction, ss.SpellData.Delay + speed);
     if (!ss.IsAboutToHit((int)((dashVel.Length() / 475) * 1000) + Game.Ping + 100, ObjectManager.Player))
         return false;
     if (ss.IsAboutToHit(1000, ObjectManager.Player) && interCir(ss.MissilePosition, ss.MissilePosition.Extend(ss.MissilePosition + a, ss.SpellData.Range + 50), from,
         radius))
         return true;
     return false;
 }
开发者ID:tramyeu,项目名称:EloBuddy,代码行数:13,代码来源:Program.cs

示例8: CanStun

        public static bool CanStun(AIHeroClient unit, Vector2 pos)
        {
            if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) || Player.Instance.IsDashing()) return false;
            var prediction = Prediction.Position.PredictUnitPosition(unit, 400);
            var predictionsList = new List<Vector3>
                        {
                            unit.ServerPosition,
                            unit.Position,
                            prediction.To3D(),
                        };

            var wallsFound = 0;
            foreach (var position in predictionsList)
            {
                for (var i = 0; i < 300; i += (int) unit.BoundingRadius)
                {
                    var cPos = pos.Extend(position, pos.Distance(position) + i).To3D();
                    if (cPos.IsWall())
                    {
                        wallsFound++;
                        break;
                    }
                }
            }
            if ((wallsFound / predictionsList.Count) >= Settings.MiscSettings.StunPercent / 100f)
            {
                return true;
            }

            return false;
        }
开发者ID:alvothefirst,项目名称:EloBuddy,代码行数:31,代码来源:SpellLib.cs

示例9: IsWallStunable

 private bool IsWallStunable(Vector2 from, Vector2 to)
 {
     float count = from.Distance(to);
     for (uint i = 0; i <= count; i += 25)
     {
         Vector2 pos = from.Extend(ObjectManager.Player.ServerPosition.To2D(), -i);
         var colFlags = NavMesh.GetCollisionFlags(pos.X, pos.Y);
         if (colFlags.HasFlag(CollisionFlags.Wall) || colFlags.HasFlag(CollisionFlags.Building))
             return true;
     }
     return false;
 }
开发者ID:xQxCPMxQx,项目名称:Leaguesharp-7,代码行数:12,代码来源:Azir.cs

示例10: IsCondemnable

        public static bool IsCondemnable(this Obj_AI_Hero hero)
        {
            if (!hero.IsValidTarget(550f) || hero.HasBuffOfType(BuffType.SpellShield) ||
                hero.HasBuffOfType(BuffType.SpellImmunity) || hero.IsDashing()) return false;

            //values for pred calc pP = player position; p = enemy position; pD = push distance
            var pP = Heroes.Player.ServerPosition;
            var p = hero.ServerPosition;
            var pD = Program.ComboMenu.Item("EPushDist").GetValue<Slider>().Value;
            var mode = Program.ComboMenu.Item("EMode").GetValue<StringList>().SelectedValue;

            if (mode == "PRADA" &&
                (p.Extend(pP, -pD).IsCollisionable() || p.Extend(pP, -pD/2f).IsCollisionable() ||
                 p.Extend(pP, -pD/3f).IsCollisionable()))
            {
                if (!hero.CanMove ||
                    (hero.IsWindingUp && Program.ComboMenu.Item("EHitchance").GetValue<Slider>().Value < 100))
                    return true;

                if (Program.ComboMenu.Item("EHitchance").GetValue<Slider>().Value <= 85)
                {
                    var prediction = Program.E.GetPrediction(hero);
                    for (var i = 15; i < pD; i += 75)
                    {
                        var posCF = NavMesh.GetCollisionFlags(
                            prediction.UnitPosition.To2D()
                                .Extend(
                                    pP.To2D(),
                                    -i)
                                .To3D());
                        if (posCF.HasFlag(CollisionFlags.Wall) || posCF.HasFlag(CollisionFlags.Building))
                        {
                            return true;
                        }
                    }
                    return false;
                }

                var eT = 0.063 + Game.Ping/2000f + 0.06;
                eT += (double) Program.ComboMenu.Item("EHitchance").GetValue<Slider>().Value*4/1000;
                var d = hero.MoveSpeed*eT;

                var pList = new List<Vector3>();
                pList.Add(hero.ServerPosition);

                for (var i = 0; i <= 360; i += 60)
                {
                    var v3 = new Vector2((int) (p.X + d*Math.Cos(i)), (int) (p.Y - d*Math.Sin(i))).To3D();
                    pList.Add(v3.Extend(pP, -pD));
                }

                return pList.All(el => el.IsCollisionable());
            }

            if (mode == "MARKSMAN")
            {
                var prediction = Program.E.GetPrediction(hero);
                return NavMesh.GetCollisionFlags(
                    prediction.UnitPosition.To2D()
                        .Extend(
                            pP.To2D(),
                            -pD)
                        .To3D()).HasFlag(CollisionFlags.Wall) ||
                       NavMesh.GetCollisionFlags(
                           prediction.UnitPosition.To2D()
                               .Extend(
                                   pP.To2D(),
                                   -pD/2f)
                               .To3D()).HasFlag(CollisionFlags.Wall);
            }

            if (mode == "GOSU")
            {
                var prediction = Program.E.GetPrediction(hero);
                for (var i = 15; i < pD; i += 100)
                {
                    var posCF = NavMesh.GetCollisionFlags(
                        prediction.UnitPosition.To2D()
                            .Extend(
                                pP.To2D(),
                                -i)
                            .To3D());
                    if (posCF.HasFlag(CollisionFlags.Wall) || posCF.HasFlag(CollisionFlags.Building))
                    {
                        return true;
                    }
                }
                return false;
            }

            if (mode == "SHARPSHOOTER")
            {
                var prediction = Program.E.GetPrediction(hero);
                for (var i = 15; i < pD; i += 75)
                {
                    var posCF = NavMesh.GetCollisionFlags(
                        prediction.UnitPosition.To2D()
                            .Extend(
                                pP.To2D(),
                                -i)
//.........这里部分代码省略.........
开发者ID:Hydro202,项目名称:Leaguesharp,代码行数:101,代码来源:Extensions.cs

示例11: IsCondemnable

        private bool IsCondemnable(EloBuddy.AIHeroClient hero)
        {
            if (!hero.LSIsValidTarget(550f) || hero.HasBuffOfType(EloBuddy.BuffType.SpellShield) ||
                hero.HasBuffOfType(EloBuddy.BuffType.SpellImmunity) || hero.IsDashing()) return false;

            //values for pred calc pP = player position; p = enemy position; pD = push distance
            var pP = EloBuddy.ObjectManager.Player.ServerPosition;
            var p = hero.ServerPosition;
            var pD = EPushDistanceSlider;
            var mode = EModeStringList;

            if (mode == 1 && (IsCollisionable(p.LSExtend(pP, -pD)) || IsCollisionable(p.LSExtend(pP, -pD / 2f)) ||
                                         IsCollisionable(p.LSExtend(pP, -pD / 3f))))
            {
                if (!hero.CanMove)
                    return true;

                var enemiesCount = EloBuddy.ObjectManager.Player.CountEnemyHeroesInRange(1200);
                if (enemiesCount > 1 && enemiesCount <= 3)
                {
                    var prediction = E.GetPrediction(hero);
                    for (var i = 15; i < pD; i += 75)
                    {
                        if (i > pD)
                        {
                            var lastPosFlags = EloBuddy.NavMesh.GetCollisionFlags(
                            prediction.UnitPosition.ToVector2()
                                .Extend(
                                    pP.ToVector2(),
                                    -pD)
                                .ToVector3());
                            if (lastPosFlags.HasFlag(EloBuddy.CollisionFlags.Wall) || lastPosFlags.HasFlag(EloBuddy.CollisionFlags.Building))
                            {
                                return true;
                            }
                            return false;
                        }
                        var posFlags = EloBuddy.NavMesh.GetCollisionFlags(
                            prediction.UnitPosition.ToVector2()
                                .Extend(
                                    pP.ToVector2(),
                                    -i)
                                .ToVector3());
                        if (posFlags.HasFlag(EloBuddy.CollisionFlags.Wall) || posFlags.HasFlag(EloBuddy.CollisionFlags.Building))
                        {
                            return true;
                        }
                    }
                    return false;
                }
                else
                {
                    var hitchance = EHitchanceSlider;
                    var angle = 0.20 * hitchance;
                    const float travelDistance = 0.5f;
                    var alpha = new Vector2((float)(p.X + travelDistance * Math.Cos(Math.PI / 180 * angle)),
                        (float)(p.X + travelDistance * Math.Sin(Math.PI / 180 * angle)));
                    var beta = new Vector2((float)(p.X - travelDistance * Math.Cos(Math.PI / 180 * angle)),
                        (float)(p.X - travelDistance * Math.Sin(Math.PI / 180 * angle)));

                    for (var i = 15; i < pD; i += 100)
                    {
                        if (i > pD) return false;
                        if (IsCollisionable(pP.ToVector2().Extend(alpha,
                            i)
                            .ToVector3()) && IsCollisionable(pP.ToVector2().Extend(beta, i).ToVector3())) return true;
                    }
                    return false;
                }
            }

            if (mode == 2 &&
                (IsCollisionable(p.LSExtend(pP, -pD)) || IsCollisionable(p.LSExtend(pP, -pD / 2f)) ||
                 IsCollisionable(p.LSExtend(pP, -pD / 3f))))
            {
                if (!hero.CanMove ||
                    (hero.Spellbook.IsAutoAttacking))
                    return true;

                var hitchance = EHitchanceSlider;
                var angle = 0.20 * hitchance;
                const float travelDistance = 0.5f;
                var alpha = new Vector2((float)(p.X + travelDistance * Math.Cos(Math.PI / 180 * angle)),
                    (float)(p.X + travelDistance * Math.Sin(Math.PI / 180 * angle)));
                var beta = new Vector2((float)(p.X - travelDistance * Math.Cos(Math.PI / 180 * angle)),
                    (float)(p.X - travelDistance * Math.Sin(Math.PI / 180 * angle)));

                for (var i = 15; i < pD; i += 100)
                {
                    if (i > pD)
                    {
                        return IsCollisionable(alpha.Extend(pP.ToVector2(),
                            -pD)
                            .ToVector3()) && IsCollisionable(beta.Extend(pP.ToVector2(), -pD).ToVector3());
                    }
                    if (IsCollisionable(alpha.Extend(pP.ToVector2(),
                        -i)
                        .ToVector3()) && IsCollisionable(beta.Extend(pP.ToVector2(), -i).ToVector3())) return true;
                }
                return false;
//.........这里部分代码省略.........
开发者ID:yashine59fr,项目名称:PortAIO,代码行数:101,代码来源:Vayne.cs

示例12: getEndOfMissilePosition

        private static Vector2 getEndOfMissilePosition(Vector2 basePosition, Vector2 endPosition, int dividend, out Obj_AI_Base enemyHit, Obj_AI_Base ignoreCollisionWithThisUnit = null)
        {
            List<Obj_AI_Base> enemiesHitByQ = new List<Obj_AI_Base>();
            foreach (Obj_AI_Base enemy in EntityManager.Enemies.Where(a=>!a.IsDead && a.Distance(vel) <= Q.Range * 2))
                if ((ignoreCollisionWithThisUnit == null || enemy.Name != ignoreCollisionWithThisUnit.Name) && Prediction.Position.Collision.LinearMissileCollision(enemy, basePosition, endPosition, Q.Speed, Q.Width, Q.CastDelay))
                    enemiesHitByQ.Add(enemy);

            if (enemiesHitByQ.Count == 0)
            {
                enemyHit = null;
                return basePosition.Extend(endPosition, (Q.Range / numQDivideTimes) * dividend);
            }
            else
            {
                enemyHit = enemiesHitByQ.OrderByDescending(a => a.Distance(basePosition)).FirstOrDefault();
                return endPosition;//basePosition.Extend(endPosition, enemiesHitByQ.OrderByDescending(a => a.Distance(basePosition)).FirstOrDefault().Distance(basePosition));
            }
        }
开发者ID:Sicryption,项目名称:EloBuddyAddons,代码行数:18,代码来源:Program.cs

示例13: GeneratePath

            private static Queue<Vector2> GeneratePath(Vector2 start, Vector2 end)
            {
                //return PathGenerator.GeneratePath(start.ToWorldPoint().To2D(), end.ToWorldPoint().To2D());
                var d = start.Distance(end);

                var path = new Queue<Vector2>();

                if (d < 75)
                {
                    path.Enqueue(end);
                    return path;
                }

                var increment = (int) d / 30; //(2 * d / FPS)
                var count = 0;
                for (var i = 0; i < d; i += increment)
                {
                    if (i > d)
                    {
                        break;
                    }

                    var point = start.Extend(end, i);
                    if (count++ % 10 == 0)
                    {
                        point.Randomize(10, 50);

                        if (count % 6 == 0)
                        {
                            point.Randomize(50, 100);
                        }
                    }

                    path.Enqueue(point);
                }

                path.Enqueue(end);
                return path;
            }
开发者ID:Marandini,项目名称:LeagueSharp,代码行数:39,代码来源:MouseManager.cs

示例14: 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.Extend(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.To2D();
                                    Evading = true;

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

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

示例15: InsecCombo

 private static void InsecCombo(Vector2 pos)
 {
     var vTarget = SimpleTs.GetTarget(Q.Range, SimpleTs.DamageType.Magical);
     if (!(vTarget.Distance(pos) <= 700)) return;
     var newpos = pos.Extend(vTarget.Position.To2D(), 700);
     Q.Cast(newpos, true);
     E.Cast(newpos, true);
 }
开发者ID:xcxooxl,项目名称:Lsharp3,代码行数:8,代码来源:Gragas.cs


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