Is there a nicer way to compare a point to each corner of a rect? I need to check if the green point is within the rect before allowing code to run.
Diagram
Comparing four corners one by one at the moment :
...
if (x > _contraintCorners[0].x && y > _contraintCorners[0].y &&
x < _contraintCorners[1].x && y > _contraintCorners[1].y &&
x > _contraintCorners[2].x && y < _contraintCorners[2].y &&
x < _contraintCorners[3].x && y < _contraintCorners[3].y)
{
//Do movement
}