Skip to content

Instantly share code, notes, and snippets.

@manwithsteelnerves
Last active May 31, 2017 13:51
Show Gist options
  • Save manwithsteelnerves/47f22778340cc0d6ff09882ebe02c66f to your computer and use it in GitHub Desktop.
Save manwithsteelnerves/47f22778340cc0d6ff09882ebe02c66f to your computer and use it in GitHub Desktop.
Rect Contains
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