Exemplo n.º 1
0
        public override Rectangle[] getCollisionBoxes()
        {
            Rectangle[] r = new Rectangle[bounds.w * bounds.h];

            for (int i = 0; i < bounds.h; i++) {
                for (int j = 0; j < bounds.w; j++) {
                    r[i * bounds.w + j] = new Rectangle(bounds.x + j, bounds.y + i, 1, 1);
                }
            }

            return r;
        }
Exemplo n.º 2
0
 public static double Distance(Rectangle r1, Rectangle r2)
 {
     return Math.Sqrt(Math.Pow(r1.x - r2.x, 2) + Math.Pow(r1.y - r2.y, 2));
 }
Exemplo n.º 3
0
 public static bool Contains(Rectangle a, Point p)
 {
     return (p.x >= a.x && p.x <= a.x + a.w && p.y >= a.y && p.y <= a.y + a.h);
 }
Exemplo n.º 4
0
 public static bool Intersects(Rectangle a, Rectangle b)
 {
     return Contains(a, b.getTopLeft()) || Contains(a, b.getBottomRight());
 }
Exemplo n.º 5
0
 public BasicRoom(int x, int y, int w, int h)
 {
     bounds = new Rectangle(x, y, w, h);
 }