Exemple #1
0
 public RectangleDrawing(
     Vector3 pos, Vector2 size, Vector3 normal,
     RectPivot pivot          = RectPivot.Corner,
     float thickness          = DrawInstructionDefaults.DefaultLineThickness,
     float cornerRadius       = 0,
     Color?color              = null,
     Transform localTransform = null)
 {
     _pos            = pos;
     _size           = size;
     _normal         = normal;
     _thickness      = thickness;
     _cornerRadius   = cornerRadius;
     _color          = color ?? DrawInstructionDefaults.DefaultColor;
     _localTransform = localTransform;
     _pivot          = pivot;
 }
 public static Rect GetRect(this RectPivot pivot, float w, float h) => pivot == RectPivot.Corner ? new Rect(0, 0, w, h) : new Rect(-w / 2, -h / 2, w, h);
 public static Rect GetRect(this RectPivot pivot, Vector2 size) => pivot.GetRect(size.x, size.y);