using UnityEngine;
namespace EditorAttributes
{
///
/// Draws a handle for the appropriate type
///
public class DrawHandleAttribute : PropertyAttribute, IColorAttribute
{
public float R { get; private set; }
public float G { get; private set; }
public float B { get; private set; }
public bool UseRGB { get; private set; }
public string HexColor { get; private set; }
public GUIColor Color { get; private set; }
public Space HandleSpace { get; private set; }
///
/// Draws a handle for the appropriate type
///
/// The color of the handle
/// In which coordinate space to place the handle
public DrawHandleAttribute(GUIColor handleColor = GUIColor.Default, Space handleSpace = Space.World)
{
Color = handleColor;
HandleSpace = handleSpace;
}
///
/// Draws a handle for the appropriate type
///
/// Red amount
/// Green amount
/// Blue amount
/// In which coordinate space to place the handle
public DrawHandleAttribute(float r, float g, float b, Space handleSpace = Space.World)
{
UseRGB = true;
R = r;
G = g;
B = b;
HandleSpace = handleSpace;
}
///
/// Draws a handle for the appropriate type
///
/// The color in hexadecimal
/// In which coordinate space to place the handle
public DrawHandleAttribute(string hexColor, Space handleSpace = Space.World)
{
HexColor = hexColor;
HandleSpace = handleSpace;
}
}
}