/// <summary> /// Return true iff there are objects in the given rectangle /// </summary> public bool ObjectsInRect(FloatRectangle checkOn) { foreach (GameObject inGame in allNotMenuObjects) { FloatRectangle recForObj = new FloatRectangle(inGame.Left, inGame.Right, inGame.Top, inGame.Bottom); if (recForObj.Intersects(checkOn)) { return(true); } } return(false); }
public bool Intersects(FloatRectangle anotherRect) { return(Left < anotherRect.Right && Right > anotherRect.Left && Top < anotherRect.Bottom && Bottom > anotherRect.Top); }