using System; using System.Collections.Generic; using UnityEngine; namespace Framework.Input { /// Action to which axes and buttons on input devices can be bound public interface IAction { /// Unique name of the action string Name { get; } /// Describes what purpose the action serves /// /// Can be displayed to the user in the key binding screen, for example, /// to explain what the action does. /// string Description { get; } /// Keys and buttons that have been bound to this action /// /// Simply adding a key or button to this collection will bind it. /// ICollection BoundKeys { get; } /// Joystick axes that have been bound to this action /// /// Simply adding a joystick axis to this collection will bind it. /// ICollection BoundJoystickAxes { get; } /// Whether the action is currently active /// /// If joystick axes are bound to this action, it becomes active when the axis /// goes over 67% and inactive when the axis goes under 33%. This prevents /// flickering of the input between active/inactive if the axis has noise. /// bool IsActive { get; } /// Whether the action has become active since it was last checked /// /// This goes high as soon as the action becomes active and is only reset /// in the next update phase after it has been queried at least once. /// bool WasTriggered { get; } /// Analogue state of the action /// /// If keys or buttons are bound to the action, these will immediately result /// in a value of 1.0. Analogue axes will result in v /// float State { get; } /// Removes all bound keys, buttons and axes from the action void RemoveAllBindings(); /// Whether the action is no longer part of the input mapper /// /// /// You only need to bother with this if two conditions apply: you save /// references to instances and remove actions from /// the input mapper through or other means. In that /// particular case, you will have actions that no longer belong to /// the input mapper and thus will no longer get updated: /// /// /// /// /// IAction action = myInputMapper.CreateAction("Jump"); /// myInputMapper.Actions.Clear(); // Remove all actions /// /// bool isAbandoned = action.IsAbandoned; // true /// /// /// /// bool IsAbandoned { get; } } } // namespace Framework.Input