예제 #1
0
        public static void DrawLines(Vector2[] points, Color[] colors, float width)
        {
            ThrowIf.ArgumentIsNull(points, "points");
            ThrowIf.ArgumentIsNull(colors, "colors");
            ThrowIf.False(points.Length == colors.Length, "Points and colors array must be the same length.");

            for (int i = 0; i < points.Length; ++i)
            {
                Vector2 start = points[i];
                Vector2 end   = points[MathEx.Wrap(i + 1, 0, points.Length - 1)];
                Color   color = colors[i];

                if (Mathf.Abs(start.x - end.x) > Mathf.Abs(start.y - end.y))
                {
                    GUIEx.DrawBox(new Rect(start.x, start.y, end.x - start.x, width), color);
                }
                else
                {
                    GUIEx.DrawBox(new Rect(start.x, start.y, width, end.y - start.y), color);
                }
                GUIEx.PopColor();
            }
        }
예제 #2
0
 public static void Empty <T>(IEnumerable <T> obj, string message, params object[] args)
 {
     ThrowIf.Null(obj, message, args);
     ThrowIf.False(obj.Any(), message, args);
 }