From e846c64d6f927879cb8a095e62d773a8d7b3c9f4 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 15 Oct 2020 07:24:10 +0800 Subject: *ability system --- .../Plugins/AdvancedInspector/Attributes/Angle.cs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Assets/Plugins/AdvancedInspector/Attributes/Angle.cs (limited to 'Assets/Plugins/AdvancedInspector/Attributes/Angle.cs') diff --git a/Assets/Plugins/AdvancedInspector/Attributes/Angle.cs b/Assets/Plugins/AdvancedInspector/Attributes/Angle.cs new file mode 100644 index 00000000..8b80ade5 --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Attributes/Angle.cs @@ -0,0 +1,34 @@ +using System; + +namespace AdvancedInspector +{ + /// + /// Turns a float/int into a spinning knob. + /// Because... Fancy. + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class AngleAttribute : Attribute, IListAttribute + { + private float snap = -1; + + /// + /// Makes the control snap to the multiple of that value + /// Default; -1. Negative values turn this behaviour off. + /// + public float Snap + { + get { return snap; } + } + + public AngleAttribute() { } + + /// + /// If snap is -1, the snap is disable. + /// Snap makes the wheel "stick" to multiple of a fixed value. + /// + public AngleAttribute(float snap) + { + this.snap = snap; + } + } +} \ No newline at end of file -- cgit v1.1-26-g67d0