예제 #1
0
파일: Polygon.cs 프로젝트: bfollington/Bolt
        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
파일: Hitbox.cs 프로젝트: bfollington/Bolt
        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
파일: Polybox.cs 프로젝트: bfollington/Bolt
        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));
        }