Beispiel #1
0
 void OnGUI()
 {
     if (drawRect)
     {
         // Create a rect from both mouse positions
         var rect = MouseUtils.GetScreenRect(firstPosition, Input.mousePosition);
         MouseUtils.DrawScreenRect(rect, new Color(0.8f, 0.8f, 0.95f, 0.25f));
         MouseUtils.DrawScreenRectBorder(rect, 2, new Color(0.8f, 0.8f, 0.95f));
     }
 }
Beispiel #2
0
 public static void DrawScreenRectBorder(Rect rect, float thickness, Color color)
 {
     // Top
     MouseUtils.DrawScreenRect(new Rect(rect.xMin, rect.yMin, rect.width, thickness), color);
     // Left
     MouseUtils.DrawScreenRect(new Rect(rect.xMin, rect.yMin, thickness, rect.height), color);
     // Right
     MouseUtils.DrawScreenRect(new Rect(rect.xMax - thickness, rect.yMin, thickness, rect.height), color);
     // Bottom
     MouseUtils.DrawScreenRect(new Rect(rect.xMin, rect.yMax - thickness, rect.width, thickness), color);
 }