2
0

InputMaster.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. // GENERATED AUTOMATICALLY FROM 'Assets/InputActions/InputMaster.inputactions'
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine.InputSystem;
  6. using UnityEngine.InputSystem.Utilities;
  7. public class @InputMaster : IInputActionCollection, IDisposable
  8. {
  9. public InputActionAsset asset { get; }
  10. public @InputMaster()
  11. {
  12. asset = InputActionAsset.FromJson(@"{
  13. ""name"": ""InputMaster"",
  14. ""maps"": [
  15. {
  16. ""name"": ""Player"",
  17. ""id"": ""c0e731dc-cca5-4e31-9e39-322320614628"",
  18. ""actions"": [
  19. {
  20. ""name"": ""Steer"",
  21. ""type"": ""Value"",
  22. ""id"": ""0c2e0063-2a71-41fa-8558-c860d648d00a"",
  23. ""expectedControlType"": ""Analog"",
  24. ""processors"": """",
  25. ""interactions"": """"
  26. },
  27. {
  28. ""name"": ""Lean"",
  29. ""type"": ""Value"",
  30. ""id"": ""11b8defd-5887-45af-b2e8-f3442e007bcf"",
  31. ""expectedControlType"": ""Analog"",
  32. ""processors"": """",
  33. ""interactions"": """"
  34. },
  35. {
  36. ""name"": ""Speed"",
  37. ""type"": ""Value"",
  38. ""id"": ""0368d4e7-2254-4f77-a048-c03d5a9e9466"",
  39. ""expectedControlType"": ""Analog"",
  40. ""processors"": """",
  41. ""interactions"": """"
  42. }
  43. ],
  44. ""bindings"": [
  45. {
  46. ""name"": ""1D Axis"",
  47. ""id"": ""809e58c9-063d-4091-85dd-c6912da7887c"",
  48. ""path"": ""1DAxis(minValue=-20,maxValue=20)"",
  49. ""interactions"": """",
  50. ""processors"": """",
  51. ""groups"": """",
  52. ""action"": ""Steer"",
  53. ""isComposite"": true,
  54. ""isPartOfComposite"": false
  55. },
  56. {
  57. ""name"": ""negative"",
  58. ""id"": ""918a761d-d749-4fab-943b-b15b684ff46b"",
  59. ""path"": ""<Gamepad>/leftStick/left"",
  60. ""interactions"": """",
  61. ""processors"": """",
  62. ""groups"": ""Xbox Control Scheme"",
  63. ""action"": ""Steer"",
  64. ""isComposite"": false,
  65. ""isPartOfComposite"": true
  66. },
  67. {
  68. ""name"": ""positive"",
  69. ""id"": ""d09cba85-d987-46fc-89c7-98a9410da5ea"",
  70. ""path"": ""<Gamepad>/leftStick/right"",
  71. ""interactions"": """",
  72. ""processors"": """",
  73. ""groups"": ""Xbox Control Scheme"",
  74. ""action"": ""Steer"",
  75. ""isComposite"": false,
  76. ""isPartOfComposite"": true
  77. },
  78. {
  79. ""name"": ""1D Axis"",
  80. ""id"": ""ca704029-9a84-41e8-9def-5edf0439737a"",
  81. ""path"": ""1DAxis(minValue=-20,maxValue=20)"",
  82. ""interactions"": """",
  83. ""processors"": """",
  84. ""groups"": """",
  85. ""action"": ""Lean"",
  86. ""isComposite"": true,
  87. ""isPartOfComposite"": false
  88. },
  89. {
  90. ""name"": ""negative"",
  91. ""id"": ""02ebe08c-4529-44b9-9d52-47c3454c09ed"",
  92. ""path"": ""<Gamepad>/rightStick/left"",
  93. ""interactions"": """",
  94. ""processors"": """",
  95. ""groups"": ""Xbox Control Scheme"",
  96. ""action"": ""Lean"",
  97. ""isComposite"": false,
  98. ""isPartOfComposite"": true
  99. },
  100. {
  101. ""name"": ""positive"",
  102. ""id"": ""afcc1116-c915-451a-9058-b47acbc00d4d"",
  103. ""path"": ""<Gamepad>/rightStick/right"",
  104. ""interactions"": """",
  105. ""processors"": """",
  106. ""groups"": ""Xbox Control Scheme"",
  107. ""action"": ""Lean"",
  108. ""isComposite"": false,
  109. ""isPartOfComposite"": true
  110. },
  111. {
  112. ""name"": ""1D Axis"",
  113. ""id"": ""ef5544f0-948e-4ac2-9b5a-740ab381b571"",
  114. ""path"": ""1DAxis(minValue=-300,maxValue=300)"",
  115. ""interactions"": """",
  116. ""processors"": """",
  117. ""groups"": """",
  118. ""action"": ""Speed"",
  119. ""isComposite"": true,
  120. ""isPartOfComposite"": false
  121. },
  122. {
  123. ""name"": ""negative"",
  124. ""id"": ""190c1e38-5a07-4cf2-ac16-b1d89d70a921"",
  125. ""path"": ""<Gamepad>/leftTrigger"",
  126. ""interactions"": """",
  127. ""processors"": """",
  128. ""groups"": ""Xbox Control Scheme"",
  129. ""action"": ""Speed"",
  130. ""isComposite"": false,
  131. ""isPartOfComposite"": true
  132. },
  133. {
  134. ""name"": ""positive"",
  135. ""id"": ""aa7db5f0-9d6e-44b0-bdd2-fad109320909"",
  136. ""path"": ""<Gamepad>/rightTrigger"",
  137. ""interactions"": """",
  138. ""processors"": """",
  139. ""groups"": ""Xbox Control Scheme"",
  140. ""action"": ""Speed"",
  141. ""isComposite"": false,
  142. ""isPartOfComposite"": true
  143. }
  144. ]
  145. }
  146. ],
  147. ""controlSchemes"": [
  148. {
  149. ""name"": ""Xbox Control Scheme"",
  150. ""bindingGroup"": ""Xbox Control Scheme"",
  151. ""devices"": [
  152. {
  153. ""devicePath"": ""<XInputController>"",
  154. ""isOptional"": false,
  155. ""isOR"": false
  156. }
  157. ]
  158. }
  159. ]
  160. }");
  161. // Player
  162. m_Player = asset.FindActionMap("Player", throwIfNotFound: true);
  163. m_Player_Steer = m_Player.FindAction("Steer", throwIfNotFound: true);
  164. m_Player_Lean = m_Player.FindAction("Lean", throwIfNotFound: true);
  165. m_Player_Speed = m_Player.FindAction("Speed", throwIfNotFound: true);
  166. }
  167. public void Dispose()
  168. {
  169. UnityEngine.Object.Destroy(asset);
  170. }
  171. public InputBinding? bindingMask
  172. {
  173. get => asset.bindingMask;
  174. set => asset.bindingMask = value;
  175. }
  176. public ReadOnlyArray<InputDevice>? devices
  177. {
  178. get => asset.devices;
  179. set => asset.devices = value;
  180. }
  181. public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
  182. public bool Contains(InputAction action)
  183. {
  184. return asset.Contains(action);
  185. }
  186. public IEnumerator<InputAction> GetEnumerator()
  187. {
  188. return asset.GetEnumerator();
  189. }
  190. IEnumerator IEnumerable.GetEnumerator()
  191. {
  192. return GetEnumerator();
  193. }
  194. public void Enable()
  195. {
  196. asset.Enable();
  197. }
  198. public void Disable()
  199. {
  200. asset.Disable();
  201. }
  202. // Player
  203. private readonly InputActionMap m_Player;
  204. private IPlayerActions m_PlayerActionsCallbackInterface;
  205. private readonly InputAction m_Player_Steer;
  206. private readonly InputAction m_Player_Lean;
  207. private readonly InputAction m_Player_Speed;
  208. public struct PlayerActions
  209. {
  210. private @InputMaster m_Wrapper;
  211. public PlayerActions(@InputMaster wrapper) { m_Wrapper = wrapper; }
  212. public InputAction @Steer => m_Wrapper.m_Player_Steer;
  213. public InputAction @Lean => m_Wrapper.m_Player_Lean;
  214. public InputAction @Speed => m_Wrapper.m_Player_Speed;
  215. public InputActionMap Get() { return m_Wrapper.m_Player; }
  216. public void Enable() { Get().Enable(); }
  217. public void Disable() { Get().Disable(); }
  218. public bool enabled => Get().enabled;
  219. public static implicit operator InputActionMap(PlayerActions set) { return set.Get(); }
  220. public void SetCallbacks(IPlayerActions instance)
  221. {
  222. if (m_Wrapper.m_PlayerActionsCallbackInterface != null)
  223. {
  224. @Steer.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSteer;
  225. @Steer.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSteer;
  226. @Steer.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSteer;
  227. @Lean.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLean;
  228. @Lean.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLean;
  229. @Lean.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLean;
  230. @Speed.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSpeed;
  231. @Speed.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSpeed;
  232. @Speed.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnSpeed;
  233. }
  234. m_Wrapper.m_PlayerActionsCallbackInterface = instance;
  235. if (instance != null)
  236. {
  237. @Steer.started += instance.OnSteer;
  238. @Steer.performed += instance.OnSteer;
  239. @Steer.canceled += instance.OnSteer;
  240. @Lean.started += instance.OnLean;
  241. @Lean.performed += instance.OnLean;
  242. @Lean.canceled += instance.OnLean;
  243. @Speed.started += instance.OnSpeed;
  244. @Speed.performed += instance.OnSpeed;
  245. @Speed.canceled += instance.OnSpeed;
  246. }
  247. }
  248. }
  249. public PlayerActions @Player => new PlayerActions(this);
  250. private int m_XboxControlSchemeSchemeIndex = -1;
  251. public InputControlScheme XboxControlSchemeScheme
  252. {
  253. get
  254. {
  255. if (m_XboxControlSchemeSchemeIndex == -1) m_XboxControlSchemeSchemeIndex = asset.FindControlSchemeIndex("Xbox Control Scheme");
  256. return asset.controlSchemes[m_XboxControlSchemeSchemeIndex];
  257. }
  258. }
  259. public interface IPlayerActions
  260. {
  261. void OnSteer(InputAction.CallbackContext context);
  262. void OnLean(InputAction.CallbackContext context);
  263. void OnSpeed(InputAction.CallbackContext context);
  264. }
  265. }