From e846c64d6f927879cb8a095e62d773a8d7b3c9f4 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 15 Oct 2020 07:24:10 +0800 Subject: *ability system --- .../AdvancedInspector/Attributes/RangeValue.cs | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Assets/Plugins/AdvancedInspector/Attributes/RangeValue.cs (limited to 'Assets/Plugins/AdvancedInspector/Attributes/RangeValue.cs') diff --git a/Assets/Plugins/AdvancedInspector/Attributes/RangeValue.cs b/Assets/Plugins/AdvancedInspector/Attributes/RangeValue.cs new file mode 100644 index 00000000..a0331216 --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Attributes/RangeValue.cs @@ -0,0 +1,40 @@ +using System; + +namespace AdvancedInspector +{ + /// + /// Similar to Unity's "Range" attribute but for the Advanced Inspector. + /// However, Unity's version is flagged to be "Field Only", while this one can be placed on Properties. + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class RangeValueAttribute : Attribute, IListAttribute + { + private float min; + + /// + /// Min value, the current value cannot go below that. + /// + public float Min + { + get { return min; } + set { min = value; } + } + + private float max; + + /// + /// Max value, the current value cannot go above that. + /// + public float Max + { + get { return max; } + set { max = value; } + } + + public RangeValueAttribute(float min, float max) + { + this.min = min; + this.max = max; + } + } +} \ No newline at end of file -- cgit v1.1-26-g67d0