/// <summary> /// Checks Yasuo wall collisions /// </summary> /// <param name="poly">Polygon to check collision</param> /// <returns>true if collision found</returns> public static bool CheckYasuoWallCollision(Geometry.Polygon spellHitBox) { if (Utils.TickCount - yasuoWallCastedTick > 4000) { return(false); } GameObject yasuoWall = ObjectManager.Get <GameObject>().Where(p => p.IsValid && Regex.IsMatch(p.Name, "_w_windwall_enemy_0.\\.troy", RegexOptions.IgnoreCase)).FirstOrDefault(); if (yasuoWall == null) { return(false); } Vector2 yasuoWallDirection = (yasuoWall.Position.To2D() - yasuoWallCastedPos).Normalized().Perpendicular(); float yasuoWallWidth = 300 + 50 * yasuoWallLevel; Vector2 yasuoWallStart = yasuoWall.Position.To2D() + yasuoWallWidth / 2f * yasuoWallDirection; Vector2 yasuoWallEnd = yasuoWallStart - yasuoWallWidth * yasuoWallDirection; Geometry.Polygon yasuoWallPoly = ClipperWrapper.DefineRectangle(yasuoWallStart, yasuoWallEnd, 5); return(ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(yasuoWallPoly), ClipperWrapper.MakePaths(spellHitBox))); }
/// <summary> /// Checks if the point is outside of polygon /// </summary> /// <param name="val">Polygon to check</param> /// <param name="point">Point to check</param> /// <returns>true if point is outside of polygon</returns> public static bool IsOutside(this Geometry.Polygon val, Vector2 point) { var p = new IntPoint(point.X, point.Y); return(Clipper.PointInPolygon(p, val.ToClipperPath()) != 1); }