IInputActionCollection.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System.Collections.Generic;
  2. using UnityEngine.InputSystem.Utilities;
  3. namespace UnityEngine.InputSystem
  4. {
  5. /// <summary>
  6. /// A collection of input actions (see <see cref="InputAction"/>).
  7. /// </summary>
  8. /// <seealso cref="InputActionMap"/>
  9. /// <seealso cref="InputActionAsset"/>
  10. public interface IInputActionCollection : IEnumerable<InputAction>
  11. {
  12. /// <summary>
  13. /// Optional mask applied to all bindings in the collection.
  14. /// </summary>
  15. /// <remarks>
  16. /// If this is not null, only bindings that match the mask will be used.
  17. /// </remarks>
  18. InputBinding? bindingMask { get; set; }
  19. ////REVIEW: should this allow restricting to a set of controls instead of confining it to just devices?
  20. /// <summary>
  21. /// Devices to use with the actions in this collection.
  22. /// </summary>
  23. /// <remarks>
  24. /// If this is set, actions in the collection will exclusively bind to devices
  25. /// in the given list. For example, if two gamepads are present in the system yet
  26. /// only one gamepad is listed here, then a "&lt;Gamepad&gt;/leftStick" binding will
  27. /// only bind to the gamepad in the list and not to the one that is only available
  28. /// globally.
  29. /// </remarks>
  30. ReadOnlyArray<InputDevice>? devices { get; set; }
  31. /// <summary>
  32. /// List of control schemes defined for the set of actions.
  33. /// </summary>
  34. /// <remarks>
  35. /// Control schemes are optional and the list may be empty.
  36. /// </remarks>
  37. ReadOnlyArray<InputControlScheme> controlSchemes { get; }
  38. /// <summary>
  39. /// Check whether the given action is contained in this collection.
  40. /// </summary>
  41. /// <param name="action">An arbitrary input action.</param>
  42. /// <returns>True if the given action is contained in the collection, false if not.</returns>
  43. /// <remarks>
  44. /// Calling this method will not allocate GC memory (unlike when iterating generically
  45. /// over the collection). Also, a collection may have a faster containment check rather than
  46. /// having to search through all its actions.
  47. /// </remarks>
  48. bool Contains(InputAction action);
  49. /// <summary>
  50. /// Enable all actions in the collection.
  51. /// </summary>
  52. void Enable();
  53. /// <summary>
  54. /// Disable all actions in the collection.
  55. /// </summary>
  56. void Disable();
  57. }
  58. }