Exemplo n.º 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;
        }
Exemplo n.º 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();
        }
Exemplo n.º 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));
        }