-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlayerActionControls.cs
219 lines (201 loc) · 7.44 KB
/
PlayerActionControls.cs
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.6.3
// from Assets/Scripts/PlayerControls.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
public partial class @PlayerActionControls: IInputActionCollection2, IDisposable
{
public InputActionAsset asset { get; }
public @PlayerActionControls()
{
asset = InputActionAsset.FromJson(@"{
""name"": ""PlayerControls"",
""maps"": [
{
""name"": ""Land"",
""id"": ""edc41772-df61-40b5-bcf1-a7e47981ecf7"",
""actions"": [
{
""name"": ""Move"",
""type"": ""PassThrough"",
""id"": ""5e26a9cb-3f9c-4ca7-bdd7-a3499e7ff676"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Jump"",
""type"": ""Button"",
""id"": ""54445534-372d-4031-b9cb-590a578c52fa"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
{
""name"": ""Sideways"",
""id"": ""bdb53229-89a2-4aaf-be5e-91b1e3161d3b"",
""path"": ""1DAxis"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Move"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""negative"",
""id"": ""f719e2a1-419a-4c5e-ae11-73079bb2d67c"",
""path"": ""<Keyboard>/a"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""positive"",
""id"": ""ca7b51c8-ffb3-440b-8497-c71021e0197d"",
""path"": ""<Keyboard>/d"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""260b8030-8d18-4458-86fb-95835703d844"",
""path"": ""<Keyboard>/space"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Jump"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
],
""controlSchemes"": []
}");
// Land
m_Land = asset.FindActionMap("Land", throwIfNotFound: true);
m_Land_Move = m_Land.FindAction("Move", throwIfNotFound: true);
m_Land_Jump = m_Land.FindAction("Jump", throwIfNotFound: true);
}
public void Dispose()
{
UnityEngine.Object.Destroy(asset);
}
public InputBinding? bindingMask
{
get => asset.bindingMask;
set => asset.bindingMask = value;
}
public ReadOnlyArray<InputDevice>? devices
{
get => asset.devices;
set => asset.devices = value;
}
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
public bool Contains(InputAction action)
{
return asset.Contains(action);
}
public IEnumerator<InputAction> GetEnumerator()
{
return asset.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public void Enable()
{
asset.Enable();
}
public void Disable()
{
asset.Disable();
}
public IEnumerable<InputBinding> bindings => asset.bindings;
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
{
return asset.FindAction(actionNameOrId, throwIfNotFound);
}
public int FindBinding(InputBinding bindingMask, out InputAction action)
{
return asset.FindBinding(bindingMask, out action);
}
// Land
private readonly InputActionMap m_Land;
private List<ILandActions> m_LandActionsCallbackInterfaces = new List<ILandActions>();
private readonly InputAction m_Land_Move;
private readonly InputAction m_Land_Jump;
public struct LandActions
{
private @PlayerActionControls m_Wrapper;
public LandActions(@PlayerActionControls wrapper) { m_Wrapper = wrapper; }
public InputAction @Move => m_Wrapper.m_Land_Move;
public InputAction @Jump => m_Wrapper.m_Land_Jump;
public InputActionMap Get() { return m_Wrapper.m_Land; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
public bool enabled => Get().enabled;
public static implicit operator InputActionMap(LandActions set) { return set.Get(); }
public void AddCallbacks(ILandActions instance)
{
if (instance == null || m_Wrapper.m_LandActionsCallbackInterfaces.Contains(instance)) return;
m_Wrapper.m_LandActionsCallbackInterfaces.Add(instance);
@Move.started += instance.OnMove;
@Move.performed += instance.OnMove;
@Move.canceled += instance.OnMove;
@Jump.started += instance.OnJump;
@Jump.performed += instance.OnJump;
@Jump.canceled += instance.OnJump;
}
private void UnregisterCallbacks(ILandActions instance)
{
@Move.started -= instance.OnMove;
@Move.performed -= instance.OnMove;
@Move.canceled -= instance.OnMove;
@Jump.started -= instance.OnJump;
@Jump.performed -= instance.OnJump;
@Jump.canceled -= instance.OnJump;
}
public void RemoveCallbacks(ILandActions instance)
{
if (m_Wrapper.m_LandActionsCallbackInterfaces.Remove(instance))
UnregisterCallbacks(instance);
}
public void SetCallbacks(ILandActions instance)
{
foreach (var item in m_Wrapper.m_LandActionsCallbackInterfaces)
UnregisterCallbacks(item);
m_Wrapper.m_LandActionsCallbackInterfaces.Clear();
AddCallbacks(instance);
}
}
public LandActions @Land => new LandActions(this);
public interface ILandActions
{
void OnMove(InputAction.CallbackContext context);
void OnJump(InputAction.CallbackContext context);
}
}