void OnGUI() { if (isSelecting) { Rect rect = UnitSelectingLib.GetScreenRect(MouseStartingPosition, Input.mousePosition); //Draw the "inside" box UnitSelectingLib.DrawBox(rect, new Color(0.8f, 0.8f, 0.95f, 0.25f)); // Draw the "border" box UnitSelectingLib.DrawBoxBorder(rect, 2, new Color(0.8f, 0.8f, 0.95f)); } }
public static void DrawBoxBorder(Rect rect, float thickness, Color color) { // Ve tung canh cua hinh chu nhat // thickness: Do dai cua canh hinh chu nhat // Top UnitSelectingLib.DrawBox(new Rect(rect.xMin, rect.yMin, rect.width, thickness), color); // Left UnitSelectingLib.DrawBox(new Rect(rect.xMin, rect.yMin, thickness, rect.height), color); // Right UnitSelectingLib.DrawBox(new Rect(rect.xMax - thickness, rect.yMin, thickness, rect.height), color); // Bottom UnitSelectingLib.DrawBox(new Rect(rect.xMin, rect.yMax - thickness, rect.width, thickness), color); }