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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.7.0
// from Assets/Scripts/InputSystem/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 @PlayerControls: IInputActionCollection2, IDisposable
{
public InputActionAsset asset { get; }
public @PlayerControls()
{
asset = InputActionAsset.FromJson(@"{
""name"": ""PlayerControls"",
""maps"": [
{
""name"": ""Player Movement"",
""id"": ""cfb355ad-e0aa-4dad-9111-af6e3f1271b2"",
""actions"": [
{
""name"": ""Movement"",
""type"": ""PassThrough"",
""id"": ""1ab3b457-9558-4d1c-b580-1b6a7d3cbd45"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Camera"",
""type"": ""PassThrough"",
""id"": ""bb5b6b4b-5b42-4192-a498-10356a2b125a"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
}
],
""bindings"": [
{
""name"": ""WASD"",
""id"": ""d8a77518-37e0-4dd9-8c87-9a6f159ed71b"",
""path"": ""2DVector"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Movement"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""up"",
""id"": ""4eb43c7b-9a1d-4f13-877b-6b3acf19ad17"",
""path"": ""<Keyboard>/w"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Movement"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""down"",
""id"": ""2228edfc-964a-42e3-b1ba-53aebb8f0d5f"",
""path"": ""<Keyboard>/s"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Movement"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""left"",
""id"": ""a35a6c7a-e429-4cb5-90d4-edf345cd188d"",
""path"": ""<Keyboard>/a"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Movement"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""right"",
""id"": ""c9d8817d-167d-4526-b441-3bfd52363503"",
""path"": ""<Keyboard>/d"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Movement"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""d0d72338-edcb-44b9-a675-823b93f06cc0"",
""path"": ""<Gamepad>/rightStick"",
""interactions"": """",
""processors"": ""StickDeadzone"",
""groups"": """",
""action"": ""Camera"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""b1f249ca-76f5-4443-85fe-eff12e361675"",
""path"": ""<Mouse>/delta"",
""interactions"": """",
""processors"": ""NormalizeVector2"",
""groups"": """",
""action"": ""Camera"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
],
""controlSchemes"": []
}");
// Player Movement
m_PlayerMovement = asset.FindActionMap("Player Movement", throwIfNotFound: true);
m_PlayerMovement_Movement = m_PlayerMovement.FindAction("Movement", throwIfNotFound: true);
m_PlayerMovement_Camera = m_PlayerMovement.FindAction("Camera", 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);
}
// Player Movement
private readonly InputActionMap m_PlayerMovement;
private List<IPlayerMovementActions> m_PlayerMovementActionsCallbackInterfaces = new List<IPlayerMovementActions>();
private readonly InputAction m_PlayerMovement_Movement;
private readonly InputAction m_PlayerMovement_Camera;
public struct PlayerMovementActions
{
private @PlayerControls m_Wrapper;
public PlayerMovementActions(@PlayerControls wrapper) { m_Wrapper = wrapper; }
public InputAction @Movement => m_Wrapper.m_PlayerMovement_Movement;
public InputAction @Camera => m_Wrapper.m_PlayerMovement_Camera;
public InputActionMap Get() { return m_Wrapper.m_PlayerMovement; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
public bool enabled => Get().enabled;
public static implicit operator InputActionMap(PlayerMovementActions set) { return set.Get(); }
public void AddCallbacks(IPlayerMovementActions instance)
{
if (instance == null || m_Wrapper.m_PlayerMovementActionsCallbackInterfaces.Contains(instance)) return;
m_Wrapper.m_PlayerMovementActionsCallbackInterfaces.Add(instance);
@Movement.started += instance.OnMovement;
@Movement.performed += instance.OnMovement;
@Movement.canceled += instance.OnMovement;
@Camera.started += instance.OnCamera;
@Camera.performed += instance.OnCamera;
@Camera.canceled += instance.OnCamera;
}
private void UnregisterCallbacks(IPlayerMovementActions instance)
{
@Movement.started -= instance.OnMovement;
@Movement.performed -= instance.OnMovement;
@Movement.canceled -= instance.OnMovement;
@Camera.started -= instance.OnCamera;
@Camera.performed -= instance.OnCamera;
@Camera.canceled -= instance.OnCamera;
}
public void RemoveCallbacks(IPlayerMovementActions instance)
{
if (m_Wrapper.m_PlayerMovementActionsCallbackInterfaces.Remove(instance))
UnregisterCallbacks(instance);
}
public void SetCallbacks(IPlayerMovementActions instance)
{
foreach (var item in m_Wrapper.m_PlayerMovementActionsCallbackInterfaces)
UnregisterCallbacks(item);
m_Wrapper.m_PlayerMovementActionsCallbackInterfaces.Clear();
AddCallbacks(instance);
}
}
public PlayerMovementActions @PlayerMovement => new PlayerMovementActions(this);
public interface IPlayerMovementActions
{
void OnMovement(InputAction.CallbackContext context);
void OnCamera(InputAction.CallbackContext context);
}
}
|