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


C# Vector3.To2D方法代码示例

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


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

示例1: bestVectorToAoeFarm

            public static Vector3 bestVectorToAoeFarm(Vector3 center, float spellrange, float spellWidth, int hit = 0)
            {
                var minions = MinionManager.GetMinions(center, spellrange, MinionTypes.All, MinionTeam.NotAlly);
                Vector3 bestPos = new Vector3();
                int hits = hit;
                foreach (var minion in minions)
                {
                    if (countMinionsInrange(minion.Position, spellWidth) > hits)
                    {
                        bestPos = minion.Position;
                        hits = countMinionsInrange(minion.Position, spellWidth);
                    }
                    Vector3 newPos = new Vector3(minion.Position.X + 80, minion.Position.Y + 80, minion.Position.Z);
                    for (int i = 1; i < 4; i++)
                    {
                        var rotated = newPos.To2D().RotateAroundPoint(newPos.To2D(), 90 * i).To3D();
                        if (countMinionsInrange(rotated, spellWidth) > hits && player.Distance(rotated) <= spellrange)
                        {
                            bestPos = newPos;
                            hits = countMinionsInrange(rotated, spellWidth);
                        }
                    }
                }

                return bestPos;
            }
开发者ID:koolkaracter,项目名称:LeagueSharp,代码行数:26,代码来源:Environment.cs

示例2: bestVectorToAoeSpell

            public static Vector3 bestVectorToAoeSpell(IEnumerable<AIHeroClient> heroes,
                float spellrange,
                float spellwidth)
            {
                var bestPos = new Vector3();
                var hits = 0;
                foreach (var hero in heroes)
                {
                    if (countChampsAtrange(hero.Position, spellwidth) > hits)
                    {
                        bestPos = hero.Position;
                        hits = countChampsAtrange(hero.Position, spellwidth);
                    }
                    var newPos = new Vector3(hero.Position.X + 80, hero.Position.Y + 80, hero.Position.Z);
                    for (var i = 1; i < 4; i++)
                    {
                        var rotated = newPos.To2D().RotateAroundPoint(newPos.To2D(), 90*i).To3D();
                        if (countChampsAtrange(rotated, spellwidth) > hits && player.Distance(rotated) <= spellrange)
                        {
                            bestPos = newPos;
                            hits = countChampsAtrange(rotated, spellwidth);
                        }
                    }
                }

                return bestPos;
            }
开发者ID:Xelamats,项目名称:PortAIO,代码行数:27,代码来源:Environment.cs

示例3: Jump

        public static void Jump(Vector3 pos, bool juke = false, bool castq = true)
        {
            if (Math.Abs(Program._e.Cooldown) < 0.00001)
            {
                var extended = ObjectManager.Player.ServerPosition.To2D().Extend(pos.To2D(), 800f);
                if (!JumpTo.IsValid())
                    JumpTo = pos.To2D();

                if (Program._w.IsReady() && SoldierMgr.ActiveSoldiers.Count == 0)
                {
                    if (juke)
                    {
                        var outRadius = 250 / (float)Math.Cos(2 * Math.PI / 12);

                        for (var i = 1; i <= 12; i++)
                        {
                            var angle = i * 2 * Math.PI / 12;
                            var x = ObjectManager.Player.Position.X + outRadius * (float)Math.Cos(angle);
                            var y = ObjectManager.Player.Position.Y + outRadius * (float)Math.Sin(angle);
                            if (NavMesh.GetCollisionFlags(x, y).HasFlag(CollisionFlags.Wall) && !ObjectManager.Player.ServerPosition.To2D().Extend(new Vector2(x, y), 500f).IsWall())
                            {
                                Program._w.Cast(ObjectManager.Player.ServerPosition.To2D().Extend(new Vector2(x, y), 800f));
                                return;
                            }
                        }
                    }
                    Program._w.Cast(extended);
                }

                if (SoldierMgr.ActiveSoldiers.Count > 0 && Program._q.IsReady())
                {
                    var closestSoldier = SoldierMgr.ActiveSoldiers.MinOrDefault(s => s.Position.To2D().Distance(extended, true));
                    CastELocation = closestSoldier.Position.To2D();
                    CastQLocation = closestSoldier.Position.To2D().Extend(JumpTo, 800f);

                    if (CastELocation.Distance(JumpTo) > ObjectManager.Player.ServerPosition.To2D().Distance(JumpTo) && !juke && castq)
                    {
                        CastQLocation = extended;
                        CastET = Utils.TickCount + 250;
                        Program._q.Cast(CastQLocation);
                    }
                    else
                    {
                        Program._e.Cast(CastELocation, true);
                        if (ObjectManager.Player.ServerPosition.To2D().Distance(CastELocation) < 700 && castq)
                            LeagueSharp.Common.Utility.DelayAction.Add(250, () => Program._q.Cast(CastQLocation, true));
                    }
                }
            }
            else
            {
                if (Program._q.IsReady() && CastELocation.Distance(ObjectManager.Player.ServerPosition) <= 200 && castq)
                    Program._q.Cast(CastQLocation, true);

                JumpTo = Vector2.Zero;
            }
        }
开发者ID:Xelamats,项目名称:PortAIO,代码行数:57,代码来源:JumpToMouse.cs

示例4: RotatePosition

 public static Vector3 RotatePosition(Vector3 path)
 {
     var rotateAroundPoint = path.To2D().RotateAroundPoint(Player.Instance.Position.To2D(), 180);
     var finalPath = new Vector3(rotateAroundPoint,
         NavMesh.GetHeightForPosition(rotateAroundPoint.X, rotateAroundPoint.Y));
     return finalPath;
 }
开发者ID:KarmaPanda,项目名称:EloBuddy,代码行数:7,代码来源:Pet.cs

示例5: GetCastMinionsPredictedPositions

        public static List<Vector2> GetCastMinionsPredictedPositions(List<Obj_AI_Base> minions,
            float delay,
            float width,
            float speed,
            Vector3 from,
            float range,
            bool collision,
            SkillshotType stype,
            Vector3 rangeCheckFrom = new Vector3())
        {
            var result = new List<Vector2>();
            from = from.To2D().IsValid() ? from : ObjectManager.Player.ServerPosition;
            foreach (var minion in minions)
            {
                var pos = Prediction.GetPrediction(new PredictionInput
                {
                    Unit = minion,
                    Delay = delay,
                    Radius = width,
                    Speed = speed,
                    From = from,
                    Range = range,
                    Collision = collision,
                    Type = stype,
                    RangeCheckFrom = rangeCheckFrom
                });

                if (pos.Hitchance >= HitChance.High)
                {
                    result.Add(pos.CastPosition.To2D());
                }
            }

            return result;
        }
开发者ID:Merc491,项目名称:GoodGuyJodu,代码行数:35,代码来源:YasMath.cs

示例6: CheckHeroCollision

        public static bool CheckHeroCollision(Vector3 to)
        {
            if (Position == to)
                return false;

            return Collision.CheckEnemyHeroCollision(Position.To2D(), to.To2D(), 130f, 0.25f);
        }
开发者ID:JelloBeans,项目名称:SAC,代码行数:7,代码来源:BallMgr.cs

示例7: CountEnemysInRange

 public static int CountEnemysInRange(float range, Vector3 point)
 {
     return (
         from units in ObjectManager.Get<Obj_AI_Hero>()
         where units.IsValidTarget()
         select units).Count<Obj_AI_Hero>(
             units => Vector2.Distance(point.To2D(), units.Position.To2D()) <= range);
 }
开发者ID:47110572,项目名称:LeagueSharp2,代码行数:8,代码来源:Program.cs

示例8: CountAlliesInRange

 public static int CountAlliesInRange(float range, Vector3 point)
 {
     return (
         from units in ObjectManager.Get<Obj_AI_Hero>()
         where units.IsAlly && units.IsVisible && !units.IsDead
         select units).Count<Obj_AI_Hero>(
             units => Vector2.Distance(point.To2D(), units.Position.To2D()) <= range);
 }
开发者ID:47110572,项目名称:LeagueSharp2,代码行数:8,代码来源:Program.cs

示例9: CalculatePosition

        /// <summary>
        /// Calculates Reflected Position. Returns no Vector if it is a wall, building, or prop
        /// </summary>
        /// <param name="source">The Player or Position Being Reflected</param>
        /// <param name="newPath">The Path</param>
        /// <returns></returns>
        private static Vector3 CalculatePosition(Obj_AI_Base source, Vector3 path)
        {
            var playerPosition2D = source.Position.To2D();
            var pathPosition2D = path.To2D();
            var reflectedPos = Vector2.Reflect(pathPosition2D, playerPosition2D).To3D();

            return reflectedPos;
        }
开发者ID:kaerr,项目名称:EloBuddy,代码行数:14,代码来源:Pet.cs

示例10: GetFirstWallPoint

 public static Vector3? GetFirstWallPoint(this Vector3 from, Vector3 to, float step = 25)
 {
     var wallPoint = GetFirstWallPoint(from.To2D(), to.To2D(), step);
     if (wallPoint.HasValue)
     {
         return wallPoint.Value.To3DWorld();
     }
     return null;
 }
开发者ID:tingtop747,项目名称:EloBuddy-Addons-1,代码行数:9,代码来源:VectorHelper.cs

示例11: GetScreenPosition

        public static PositionInfo GetScreenPosition(Vector3 position3D)
        {
            var position = position3D.To2D();

            var worldCenter = GetWorldCenter();
            var screenCenter = Drawing.WorldToScreen(worldCenter.To3D().SetZ(0));

            if (position3D.IsOnScreen())
            {
                var screenPosition = Drawing.WorldToScreen(position3D);

                return new PositionInfo
                {
                screenPosition = screenPosition,
                direction = (screenPosition - screenCenter).Normalized(),
                distance = worldCenter.Distance(position),
                screenCollisionDistance = worldCenter.Distance(position)
                };
            }

            var worldDir = (position - worldCenter).Normalized();
            var worldClosePosition = worldCenter + worldDir * 100;

            var screenClosePosition = Drawing.WorldToScreen(worldClosePosition.To3D().SetZ(0));

            var dir = (screenClosePosition - screenCenter).Normalized();
            var screenFarPosition = screenCenter + dir * (Math.Max(Drawing.Width, Drawing.Height) + 100);

            var ray = new Ray(screenFarPosition.To3D().SetZ(0), -dir.To3D().SetZ(0));

            var boundingBox = new BoundingBox(new Vector3(0, 0, -1),
                new Vector3(Drawing.Width, Drawing.Height, 1));

            float dist;
            var hasIntersection = ray.Intersects(ref boundingBox, out dist);

            if (hasIntersection)
            {
                var rayDirection = dir;
                var distance = worldCenter.Distance(position);
                var finalScreenPos = screenFarPosition - dir * (dist);

                return new PositionInfo
                {
                    screenPosition = position3D.IsOnScreen() ?
                            Drawing.WorldToScreen(position3D) : finalScreenPos,
                    direction = rayDirection,
                    distance = distance,
                    screenCollisionDistance = dist
                };
            }

            //Console.WriteLine("no intersect");

            return null;
        }
开发者ID:654955321,项目名称:HY_Recommend,代码行数:56,代码来源:ExtendedAwareness.cs

示例12: DrawArrow

 public static void DrawArrow(Vector3 starPosition, Vector3 endPosition, int angle, int linelength, int arrowsize, Color arrowColor)
 {
     var playerPositionExtend = starPosition.Extend(endPosition, linelength);
     var extendPlayerPos = Drawing.WorldToScreen(playerPositionExtend);
     var afterStartPosition = playerPositionExtend.Extend(starPosition,
         playerPositionExtend.Distance(starPosition) - 110);
     var starPos = Drawing.WorldToScreen(afterStartPosition);
     Drawing.DrawLine(starPos, extendPlayerPos, 1, arrowColor);
     var playerposextend = playerPositionExtend.Extend(starPosition, -130);
     var firstLineRotate = RotateByX(playerposextend.To2D(), starPosition.To2D(), angle);
     var secondLineRotate = RotateByX(playerposextend.To2D(), starPosition.To2D(), -angle);
     var extend1 = playerposextend.Extend(firstLineRotate.To3D(), arrowsize);
     var extend2 = playerposextend.Extend(secondLineRotate.To3D(), arrowsize);
     var extendpoint = Drawing.WorldToScreen(playerposextend);
     var firstLineRotatePos = Drawing.WorldToScreen(extend1);
     var secondLineRotatePos = Drawing.WorldToScreen(extend2);
    Drawing.DrawLine(extendpoint, firstLineRotatePos, 1, arrowColor);
     Drawing.DrawLine(extendpoint, secondLineRotatePos, 1, arrowColor);
 }
开发者ID:Faqer,项目名称:LeagueSharp-3,代码行数:19,代码来源:OnInsec.cs

示例13: IsFountain

 public static bool IsFountain(Vector3 position)
 {
     float fountainRange = 750;
     var map = LeagueSharp.Common.Utility.Map.GetMap();
     if (map != null && map.Type == LeagueSharp.Common.Utility.Map.MapType.SummonersRift)
     {
         fountainRange = 1050;
     }
     return ObjectManager.Get<GameObject>().Where(spawnPoint => spawnPoint is Obj_SpawnPoint && spawnPoint.IsAlly).Any(spawnPoint => Vector2.Distance(position.To2D(), spawnPoint.Position.To2D()) < fountainRange);
 }
开发者ID:jayblah,项目名称:Asuna,代码行数:10,代码来源:Helpers.cs

示例14: getERectangle

 public static Geometry.Polygon getERectangle(Vector3 finalPosition, float BoundingRadius)
 {
     var halfERange = 150f;
     var eRectangle = new Geometry.Polygon(
         Geometry.Polygon.Rectangle(
             ObjectManager.Player.ServerPosition.To2D(),
             ObjectManager.Player.ServerPosition.To2D().Extend(finalPosition.To2D(), halfERange),
             BoundingRadius)
         );
     return eRectangle;
 }
开发者ID:luizssn,项目名称:LeagueSharp,代码行数:11,代码来源:EHelper.cs

示例15: IsPassWall

 public static bool IsPassWall(Vector3 start, Vector3 end)
 {
     double count = Vector3.Distance(start, end);
     for (uint i = 0; i <= count; i += 25)
     {
         Vector2 pos = start.To2D().Extend(Player.ServerPosition.To2D(), -i);
         if (IsWall(pos))
             return true;
     }
     return false;
 }
开发者ID:leenam0910,项目名称:LSharp,代码行数:11,代码来源:Util.cs


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