Example #1
0
 public Line(Vector3 start, Vector3 end, float length = -1)
     : this(start.To2D2(), end.To2D2(), length)
 {
 }
Example #2
0
 public Rectangle(Vector3 start, Vector3 end, float width)
     : this(start.To2D2(), end.To2D2(), width)
 {
 }
Example #3
0
 public Arc(Vector3 start, Vector3 direction, float angle, float radius, int quality = 20)
     : this(start.To2D2(), direction.To2D2(), angle, radius, quality)
 {
 }
Example #4
0
 public Circle(Vector3 center, float radius, int quality = 20)
     : this(center.To2D2(), radius, quality)
 {
 }
Example #5
0
 public void Add(Vector3 point)
 {
     Points.Add(point.To2D2());
 }
Example #6
0
 public bool IsInside(Vector3 point)
 {
     return !IsOutside(point.To2D2());
 }
Example #7
0
 /// <summary>
 ///     Calculates the 2D distance to the point.
 /// </summary>
 public static float Distance4(this Obj_AI_Base unit, Vector3 point, bool squared = false)
 {
     return unit.ServerPosition.To2D2().Distance7(point.To2D2(), squared);
 }
Example #8
0
 /// <summary>
 ///     Calculates the distance to the Vector3.
 /// </summary>
 public static float Distance8(this Vector2 v, Vector3 to, bool squared = false)
 {
     return v.Distance7(to.To2D2(), squared);
 }
Example #9
0
 public Sector(Vector3 center, Vector3 direction, float angle, float radius, int quality = 20)
     : this(center.To2D2(), direction.To2D2(), angle, radius, quality)
 {
 }
Example #10
0
 public Ring(Vector3 center, float innerRadius, float outerRadius, int quality = 20)
     : this(center.To2D2(), innerRadius, outerRadius, quality)
 {
 }
Example #11
0
 /// <summary>
 ///     Returns if the Vector3 is in range of the spell.
 /// </summary>
 public bool IsInRange(Vector3 point, float range = -1)
 {
     return IsInRange(point.To2D2(), range);
 }
Example #12
0
        /// <summary>
        ///     Returns if the spell will hit the point when casted on castPosition.
        /// </summary>
        public bool WillHit(Vector3 point, Vector3 castPosition, int extraWidth = 0)
        {
            switch (Type)
            {
                case SkillshotType.SkillshotCircle:
                    if (point.To2D2().Distance8(castPosition, true) < WidthSqr)
                    {
                        return true;
                    }
                    break;

                case SkillshotType.SkillshotLine:
                    if (point.To2D2().Distance(castPosition.To2D2(), From.To2D2(), true, true) <
                        Math.Pow(Width + extraWidth, 2))
                    {
                        return true;
                    }
                    break;
                case SkillshotType.SkillshotCone:
                    var edge1 = (castPosition.To2D2() - From.To2D2()).Rotated2(-Width / 2);
                    var edge2 = edge1.Rotated2(Width);
                    var v = point.To2D2() - From.To2D2();
                    if (point.To2D2().Distance8(From, true) < RangeSqr && edge1.CrossProduct2(v) > 0 &&
                        v.CrossProduct2(edge2) > 0)
                    {
                        return true;
                    }
                    break;
            }

            return false;
        }
Example #13
0
        public static List<Vector2> GetMinionsPredictedPositions(List<Obj_AI_Base> minions,
            float delay,
            float width,
            float speed,
            Vector3 from,
            float range,
            bool collision,
            SkillshotType stype,
            Vector3 rangeCheckFrom = new Vector3())
        {
            from = from.To2D2().IsValid() ? from : ObjectManager.Player.ServerPosition;

            return (from minion in minions
                    select
                        Prediction2.GetPrediction(
                            new PredictionInput
                            {
                                Unit = minion,
                                Delay = delay,
                                Radius = width,
                                Speed = speed,
                                From = @from,
                                Range = range,
                                Collision = collision,
                                Type = stype,
                                RangeCheckFrom = rangeCheckFrom
                            })
                into pos
                    where pos.Hitchance >= HitChance.High
                    select pos.UnitPosition.To2D2()).ToList();
        }