Ejemplo n.º 1
0
 /// <summary>
 /// Tests for collision between this and building rectangle
 /// </summary>
 /// <param name="other">The rectangle</param>
 /// <returns>True if we have a collision false otherwise</returns>
 public bool CollidesWith(BoundingRectangle other)
 {
     return(CollisionHelper.Collides(this, other));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Detects a collision between two BoundingRectangles
 /// </summary>
 /// <param name="a">Bounding Rectangle 1</param>
 /// <param name="b">Bounding Rectange 2</param>
 /// <returns>True for collisions, false otherwise</returns>
 public static bool Collides(BoundingRectangle a, BoundingRectangle b)
 {
     return(!(a.Right < b.Left || a.Left > b.Right ||
              a.Top > b.Bottom || a.Bottom < b.Top));
 }