Last active
May 31, 2017 13:51
-
-
Save manwithsteelnerves/47f22778340cc0d6ff09882ebe02c66f to your computer and use it in GitHub Desktop.
Rect Contains
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool Contains (this Rect _rect1, Rect _rect2) | |
{ | |
if ((_rect1.position.x <= _rect2.position.x) && | |
(_rect1.position.x + _rect1.size.x) >= (_rect2.position.x + _rect2.size.x) && | |
(_rect1.position.y <= _rect2.position.y) && | |
(_rect1.position.y + _rect1.size.y) >= (_rect2.position.y + _rect2.size.y)) | |
{ | |
return true; | |
} | |
else | |
{ | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment