public Polygon OffsetBy(float x, float y) { var polygon = new Polygon(); foreach (var p in points) { polygon.Points.Add( new Vector2(p.x + x, p.y + y) ); } polygon.BuildEdges(); return polygon; }
public void BuildPolygon(float xOffset = 0, float yOffset = 0) { var corners = GetCorners(xOffset, yOffset); polygon = new Polygon(); foreach (var corner in corners) { polygon.Points.Add(corner); } polygon.BuildEdges(); }
public PolygonCollisionUtil.PolygonCollisionResult IntersectHitbox(Hitbox hb, float speedX, float speedY) { var poly = hb.GetPolygonRepresentation(0, 0); lastHitboxPoly = poly; return PolygonCollisionUtil.PolygonCollision(GetPolygonAtPosition(speedX, speedY), poly, new Vector2(0, 0)); }