Esempio n. 1
0
 public static void DrawScreenRectBorder(Rect rect, float thickness, Color color)
 {
     BoxSelectionGUI.DrawBox(new Rect(rect.xMin, rect.yMin, rect.width, thickness), color);
     BoxSelectionGUI.DrawBox(new Rect(rect.xMin, rect.yMin, thickness, rect.height), color);
     BoxSelectionGUI.DrawBox(new Rect(rect.xMax - thickness, rect.yMin, thickness, rect.height), color);
     BoxSelectionGUI.DrawBox(new Rect(rect.xMin, rect.yMax - thickness, rect.width, thickness), color);
 }
Esempio n. 2
0
 void OnGUI()
 {
     if (isSelecting)
     {
         Rect rect = BoxSelectionGUI.GetScreenRect(startingPos, Input.mousePosition);
         BoxSelectionGUI.DrawBox(rect, new Color(.8f, .8f, .95f, .25f));
         BoxSelectionGUI.DrawScreenRectBorder(rect, 2, new Color(.8f, .8f, .95f, .25f));
     }
 }
Esempio n. 3
0
    public bool IsWithinSelectionBounds(GameObject army)
    {
        if (!isSelecting)
        {
            return(false);
        }

        Camera cam    = Camera.main;
        Bounds bounds = BoxSelectionGUI.GetViewportBounds(cam, startingPos, Input.mousePosition);

        if (bounds.Contains(cam.WorldToViewportPoint(army.transform.position)))
        {
            Debug.Log(army.name + " is in the selection area");
        }
        return(bounds.Contains(cam.WorldToViewportPoint(army.transform.position)));
    }