示例#1
0
        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;
        }
示例#2
0
        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();
        }
示例#3
0
        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));
        }