SimpleControls.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. // GENERATED AUTOMATICALLY FROM 'Assets/Samples/SimpleDemo/SimpleControls.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 @SimpleControls: IInputActionCollection, IDisposable
  8. {
  9. public InputActionAsset asset { get; }
  10. public @SimpleControls()
  11. {
  12. asset = InputActionAsset.FromJson(@"{
  13. ""name"": ""SimpleControls"",
  14. ""maps"": [
  15. {
  16. ""name"": ""gameplay"",
  17. ""id"": ""265c38f5-dd18-4d34-b198-aec58e1627ff"",
  18. ""actions"": [
  19. {
  20. ""name"": ""fire"",
  21. ""type"": ""Button"",
  22. ""id"": ""1077f913-a9f9-41b1-acb3-b9ee0adbc744"",
  23. ""expectedControlType"": ""Button"",
  24. ""processors"": """",
  25. ""interactions"": ""Tap,SlowTap""
  26. },
  27. {
  28. ""name"": ""move"",
  29. ""type"": ""Value"",
  30. ""id"": ""50fd2809-3aa3-4a90-988e-1facf6773553"",
  31. ""expectedControlType"": ""Vector2"",
  32. ""processors"": """",
  33. ""interactions"": """"
  34. },
  35. {
  36. ""name"": ""look"",
  37. ""type"": ""Value"",
  38. ""id"": ""c60e0974-d140-4597-a40e-9862193067e9"",
  39. ""expectedControlType"": ""Vector2"",
  40. ""processors"": """",
  41. ""interactions"": """"
  42. }
  43. ],
  44. ""bindings"": [
  45. {
  46. ""name"": """",
  47. ""id"": ""abb776f3-f329-4f7b-bbf8-b577d13be018"",
  48. ""path"": ""*/{PrimaryAction}"",
  49. ""interactions"": """",
  50. ""processors"": """",
  51. ""groups"": """",
  52. ""action"": ""fire"",
  53. ""isComposite"": false,
  54. ""isPartOfComposite"": false
  55. },
  56. {
  57. ""name"": """",
  58. ""id"": ""e1b8c4dd-7b3a-4db6-a93a-0889b59b1afc"",
  59. ""path"": ""<Gamepad>/leftStick"",
  60. ""interactions"": """",
  61. ""processors"": """",
  62. ""groups"": """",
  63. ""action"": ""move"",
  64. ""isComposite"": false,
  65. ""isPartOfComposite"": false
  66. },
  67. {
  68. ""name"": ""Dpad"",
  69. ""id"": ""cefc16fc-557a-44b0-939f-2ad792876b07"",
  70. ""path"": ""Dpad"",
  71. ""interactions"": """",
  72. ""processors"": """",
  73. ""groups"": """",
  74. ""action"": ""move"",
  75. ""isComposite"": true,
  76. ""isPartOfComposite"": false
  77. },
  78. {
  79. ""name"": ""up"",
  80. ""id"": ""07244659-79df-461d-b329-defbe2fbc5f6"",
  81. ""path"": ""<Keyboard>/w"",
  82. ""interactions"": """",
  83. ""processors"": """",
  84. ""groups"": """",
  85. ""action"": ""move"",
  86. ""isComposite"": false,
  87. ""isPartOfComposite"": true
  88. },
  89. {
  90. ""name"": ""down"",
  91. ""id"": ""f0ec75cb-f02c-40d2-a33f-1fd6eab2ae0b"",
  92. ""path"": ""<Keyboard>/s"",
  93. ""interactions"": """",
  94. ""processors"": """",
  95. ""groups"": """",
  96. ""action"": ""move"",
  97. ""isComposite"": false,
  98. ""isPartOfComposite"": true
  99. },
  100. {
  101. ""name"": ""left"",
  102. ""id"": ""21fe6bfe-4721-4483-9f4a-a0031ade105c"",
  103. ""path"": ""<Keyboard>/a"",
  104. ""interactions"": """",
  105. ""processors"": """",
  106. ""groups"": """",
  107. ""action"": ""move"",
  108. ""isComposite"": false,
  109. ""isPartOfComposite"": true
  110. },
  111. {
  112. ""name"": ""right"",
  113. ""id"": ""2dd39746-c75c-4a11-838a-e59eacaf4e0b"",
  114. ""path"": ""<Keyboard>/d"",
  115. ""interactions"": """",
  116. ""processors"": """",
  117. ""groups"": """",
  118. ""action"": ""move"",
  119. ""isComposite"": false,
  120. ""isPartOfComposite"": true
  121. },
  122. {
  123. ""name"": """",
  124. ""id"": ""c106d6e6-2780-47ff-b318-396171bd54cc"",
  125. ""path"": ""<Gamepad>/rightStick"",
  126. ""interactions"": """",
  127. ""processors"": """",
  128. ""groups"": """",
  129. ""action"": ""look"",
  130. ""isComposite"": false,
  131. ""isPartOfComposite"": false
  132. },
  133. {
  134. ""name"": """",
  135. ""id"": ""578caa03-6827-4797-adfc-a59770c437fe"",
  136. ""path"": ""<Pointer>/delta"",
  137. ""interactions"": """",
  138. ""processors"": ""ScaleVector2(x=2,y=2)"",
  139. ""groups"": """",
  140. ""action"": ""look"",
  141. ""isComposite"": false,
  142. ""isPartOfComposite"": false
  143. }
  144. ]
  145. }
  146. ],
  147. ""controlSchemes"": []
  148. }");
  149. // gameplay
  150. m_gameplay = asset.FindActionMap("gameplay", throwIfNotFound: true);
  151. m_gameplay_fire = m_gameplay.FindAction("fire", throwIfNotFound: true);
  152. m_gameplay_move = m_gameplay.FindAction("move", throwIfNotFound: true);
  153. m_gameplay_look = m_gameplay.FindAction("look", throwIfNotFound: true);
  154. }
  155. public void Dispose()
  156. {
  157. UnityEngine.Object.Destroy(asset);
  158. }
  159. public InputBinding? bindingMask
  160. {
  161. get => asset.bindingMask;
  162. set => asset.bindingMask = value;
  163. }
  164. public ReadOnlyArray<InputDevice>? devices
  165. {
  166. get => asset.devices;
  167. set => asset.devices = value;
  168. }
  169. public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
  170. public bool Contains(InputAction action)
  171. {
  172. return asset.Contains(action);
  173. }
  174. public IEnumerator<InputAction> GetEnumerator()
  175. {
  176. return asset.GetEnumerator();
  177. }
  178. IEnumerator IEnumerable.GetEnumerator()
  179. {
  180. return GetEnumerator();
  181. }
  182. public void Enable()
  183. {
  184. asset.Enable();
  185. }
  186. public void Disable()
  187. {
  188. asset.Disable();
  189. }
  190. // gameplay
  191. private readonly InputActionMap m_gameplay;
  192. private IGameplayActions m_GameplayActionsCallbackInterface;
  193. private readonly InputAction m_gameplay_fire;
  194. private readonly InputAction m_gameplay_move;
  195. private readonly InputAction m_gameplay_look;
  196. public struct GameplayActions
  197. {
  198. private @SimpleControls m_Wrapper;
  199. public GameplayActions(@SimpleControls wrapper) { m_Wrapper = wrapper; }
  200. public InputAction @fire => m_Wrapper.m_gameplay_fire;
  201. public InputAction @move => m_Wrapper.m_gameplay_move;
  202. public InputAction @look => m_Wrapper.m_gameplay_look;
  203. public InputActionMap Get() { return m_Wrapper.m_gameplay; }
  204. public void Enable() { Get().Enable(); }
  205. public void Disable() { Get().Disable(); }
  206. public bool enabled => Get().enabled;
  207. public static implicit operator InputActionMap(GameplayActions set) { return set.Get(); }
  208. public void SetCallbacks(IGameplayActions instance)
  209. {
  210. if (m_Wrapper.m_GameplayActionsCallbackInterface != null)
  211. {
  212. @fire.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnFire;
  213. @fire.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnFire;
  214. @fire.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnFire;
  215. @move.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnMove;
  216. @move.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnMove;
  217. @move.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnMove;
  218. @look.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnLook;
  219. @look.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnLook;
  220. @look.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnLook;
  221. }
  222. m_Wrapper.m_GameplayActionsCallbackInterface = instance;
  223. if (instance != null)
  224. {
  225. @fire.started += instance.OnFire;
  226. @fire.performed += instance.OnFire;
  227. @fire.canceled += instance.OnFire;
  228. @move.started += instance.OnMove;
  229. @move.performed += instance.OnMove;
  230. @move.canceled += instance.OnMove;
  231. @look.started += instance.OnLook;
  232. @look.performed += instance.OnLook;
  233. @look.canceled += instance.OnLook;
  234. }
  235. }
  236. }
  237. public GameplayActions @gameplay => new GameplayActions(this);
  238. public interface IGameplayActions
  239. {
  240. void OnFire(InputAction.CallbackContext context);
  241. void OnMove(InputAction.CallbackContext context);
  242. void OnLook(InputAction.CallbackContext context);
  243. }
  244. }