blob: a03312165310736dcaccb68d15676bb4e41c67fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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;
}
}
}
|