public static void DrawHorizontalLine(float height, float spaceBetween, Color color)
        {
            GUILayout.Space(spaceBetween);
            float width = GUILayoutUtility.GetLastRect().width;
            Rect  rect  = GUILayoutUtility.GetRect(width, height);

            GUIUtils.DrawRect(rect, color);
            GUILayout.Space(spaceBetween);
        }
示例#2
0
        public static void DrawBar(Rect rect, float fillPerc, Color fillColor, Color backgroundColor, float borderWidth)
        {
            fillPerc = Mathf.Clamp01(fillPerc);

            Rect fillRect = rect;

            fillRect.position += Vector2.one * borderWidth;
            fillRect.size     -= Vector2.one * borderWidth * 2;

            // first fill with black - that will be the border
            GUIUtils.DrawRect(rect, Color.black);

            // fill with background
            GUIUtils.DrawRect(fillRect, backgroundColor);

            // draw filled part
            fillRect.width *= fillPerc;
            GUIUtils.DrawRect(fillRect, fillColor);
        }