Beispiel #1
0
 public static Vector3 GetTumblePos(this Obj_AI_Base target)
 {
     if (target.IsFacing(Player.Instance))
     {
         return(target.ServerPosition.Shorten(Player.Instance.ServerPosition, 300));
     }
     else
     {
         var aRc                = new Geometry.Polygon.Circle(Player.Instance.ServerPosition.To2D(), 300).ToClipperPath();
         var cursorPos          = Game.CursorPos;
         var targetPosition     = target.ServerPosition;
         var pList              = new List <Vector3>();
         var additionalDistance = (0.106 + Game.Ping / 2000f) * target.MoveSpeed;
         foreach (var v3 in aRc.Select(p => new Vector2(p.X, p.Y).To3D()))
         {
             if (target.IsFacing(Player.Instance))
             {
                 if (v3.Distance(targetPosition) < 350)
                 {
                     pList.Add(v3);
                 }
             }
             else
             {
                 if (v3.Distance(targetPosition) < 350 - additionalDistance)
                 {
                     pList.Add(v3);
                 }
             }
         }
         return(pList.Count > 1
             ? pList.OrderByDescending(el => el.Distance(cursorPos)).FirstOrDefault()
             : Vector3.Zero);
     }
 }
Beispiel #2
0
        public static Vector3 GetTumblePos(this Obj_AI_Base target)
        {

            if (target.IsFacing(Player.Instance))
            {
                return target.ServerPosition.Shorten(Player.Instance.ServerPosition, 300);
            }
            else
            {
                var aRc = new Geometry.Polygon.Circle(Player.Instance.ServerPosition.To2D(), 300).ToClipperPath();
                var cursorPos = Game.CursorPos;
                var targetPosition = target.ServerPosition;
                var pList = new List<Vector3>();
                var additionalDistance = (0.106 + Game.Ping / 2000f) * target.MoveSpeed;
                foreach (var v3 in aRc.Select(p => new Vector2(p.X, p.Y).To3D()))
                {
                    if (target.IsFacing(Player.Instance))
                    {
                        if (v3.Distance(targetPosition) < 350) pList.Add(v3);
                    }
                    else
                    {
                        if (v3.Distance(targetPosition) < 350 - additionalDistance) pList.Add(v3);
                    }
                }
                return pList.Count > 1
                    ? pList.OrderByDescending(el => el.Distance(cursorPos)).FirstOrDefault()
                    : Vector3.Zero;
            }
        }