File size: 3,082 Bytes
18a519f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using UnityEngine.InputSystem.Layouts;
using UnityEngine.Scripting;

namespace UnityEngine.InputSystem.Controls
{
    /// <summary>
    /// A control representing a two-dimensional motion vector that accumulates within a frame
    /// and resets at the beginning of a frame.
    /// </summary>
    /// <remarks>
    /// Delta controls are
    /// </remarks>
    /// <see cref="Pointer.delta"/>
    /// <seealso cref="Mouse.scroll"/>
    [Preserve]
    public class DeltaControl : Vector2Control
    {
        /// <summary>
        /// A synthetic axis representing the upper half of the Y axis value, i.e. the 0 to 1 range.
        /// </summary>
        /// <value>Control representing the control's upper half Y axis.</value>
        /// <remarks>
        /// The control is marked as <see cref="InputControl.synthetic"/>.
        /// </remarks>
        [InputControl(useStateFrom = "y", parameters = "clamp=1,clampMin=0,clampMax=3.402823E+38", synthetic = true, displayName = "Up")]
        [Preserve]
        public AxisControl up { get; set; }

        /// <summary>
        /// A synthetic axis representing the lower half of the Y axis value, i.e. the -1 to 1 range (inverted).
        /// </summary>
        /// <value>Control representing the control's lower half Y axis.</value>
        /// <remarks>
        /// The control is marked as <see cref="InputControl.synthetic"/>.
        /// </remarks>
        [InputControl(useStateFrom = "y", parameters = "clamp=1,clampMin=-3.402823E+38,clampMax=0,invert", synthetic = true, displayName = "Down")]
        [Preserve]
        public AxisControl down { get; set; }

        /// <summary>
        /// A synthetic axis representing the left half of the X axis value, i.e. the -1 to 1 range (inverted).
        /// </summary>
        /// <value>Control representing the control's left half X axis.</value>
        /// <remarks>
        /// The control is marked as <see cref="InputControl.synthetic"/>.
        /// </remarks>
        [InputControl(useStateFrom = "x", parameters = "clamp=1,clampMin=-3.402823E+38,clampMax=0,invert", synthetic = true, displayName = "Left")]
        [Preserve]
        public AxisControl left { get; set; }

        /// <summary>
        /// A synthetic axis representing the right half of the X axis value, i.e. the 0 to 1 range.
        /// </summary>
        /// <value>Control representing the control's right half X axis.</value>
        /// <remarks>
        /// The control is marked as <see cref="InputControl.synthetic"/>.
        /// </remarks>
        [InputControl(useStateFrom = "x", parameters = "clamp=1,clampMin=0,clampMax=3.402823E+38", synthetic = true, displayName = "Right")]
        [Preserve]
        public AxisControl right { get; set; }

        protected override void FinishSetup()
        {
            base.FinishSetup();

            up = GetChildControl<AxisControl>("up");
            down = GetChildControl<AxisControl>("down");
            left = GetChildControl<AxisControl>("left");
            right = GetChildControl<AxisControl>("right");
        }
    }
}