summaryrefslogtreecommitdiff
path: root/Assets/Plugins/AdvancedInspector/Attributes/Angle.cs
blob: 8b80ade5261eafc0fc7a89a3473f9ff61c432719 (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
using System;

namespace AdvancedInspector
{
    /// <summary>
    /// Turns a float/int into a spinning knob.
    /// Because... Fancy.
    /// </summary>
    [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
    public class AngleAttribute : Attribute, IListAttribute
    {
        private float snap = -1;

        /// <summary>
        /// Makes the control snap to the multiple of that value
        /// Default; -1. Negative values turn this behaviour off.
        /// </summary>
        public float Snap
        {
            get { return snap; }
        }

        public AngleAttribute() { }

        /// <summary>
        /// If snap is -1, the snap is disable.
        /// Snap makes the wheel "stick" to multiple of a fixed value.
        /// </summary>
        public AngleAttribute(float snap)
        {
            this.snap = snap;
        }
    }
}