diff options
author | chai <chaifix@163.com> | 2020-10-15 07:24:10 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-10-15 07:24:10 +0800 |
commit | e846c64d6f927879cb8a095e62d773a8d7b3c9f4 (patch) | |
tree | 7882744bbf2b6c7096ec15fb300f088c5a0807c5 /Assets/Plugins/AdvancedInspector/Attributes/RangeValue.cs | |
parent | cd12e74241678ee3c0752484d310b202187ba24c (diff) |
*ability system
Diffstat (limited to 'Assets/Plugins/AdvancedInspector/Attributes/RangeValue.cs')
-rw-r--r-- | Assets/Plugins/AdvancedInspector/Attributes/RangeValue.cs | 40 |
1 files changed, 40 insertions, 0 deletions
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 +{ + /// <summary> + /// 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. + /// </summary> + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class RangeValueAttribute : Attribute, IListAttribute + { + private float min; + + /// <summary> + /// Min value, the current value cannot go below that. + /// </summary> + public float Min + { + get { return min; } + set { min = value; } + } + + private float max; + + /// <summary> + /// Max value, the current value cannot go above that. + /// </summary> + 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 |