using UnityEngine.InputSystem.Interactions;
////REVIEW: this goes beyond just actions; is there a better name? just InputPhase?
////REVIEW: what about opening up phases completely to interactions and allow them to come up with whatever custom phases?
namespace UnityEngine.InputSystem
{
///
/// Trigger phase of an .
///
///
/// Actions can be triggered in steps. For example, a
/// 'slow tap' will put an action into phase when a button
/// the action is bound to is pressed. At that point, however, the action still
/// has to wait for the expiration of a timer in order to make it a 'slow tap'. If
/// the button is release before the timer expires, the action will be
/// whereas if the button is held long enough, the action will be .
///
///
///
///
///
///
public enum InputActionPhase
{
///
/// The action is not enabled.
///
Disabled,
///
/// The action is enabled and waiting for input on its associated controls.
///
/// This is the phase that an action goes back to once it has been
/// or .
///
Waiting,
///
/// An associated control has been actuated such that it may lead to the action
/// being triggered. Will lead to getting called.
///
/// This phase will only be invoked if there are interactions on the respective control
/// binding. Without any interactions, an action will go straight from
/// into and back into whenever an associated
/// control changes value.
///
/// An example of an interaction that uses the phase is .
/// When the button it is bound to is pressed, the associated action goes into the
/// phase. At this point, the interaction does not yet know whether the button press will result in just
/// a tap or will indeed result in slow tap. If the button is released before the time it takes to
/// recognize a slow tap, then the action will go to and then back to .
/// If, however, the button is held long enough for it to qualify as a slow tap, the action will progress
/// to and then go back to .
///
/// can be useful for UI feedback. For example, in a game where the weapon can be charged,
/// UI feedback can be initiated when the action is .
///
///
///
/// fireAction.started +=
/// ctx =>
/// {
/// if (ctx.interaction is SlowTapInteraction)
/// {
/// weaponCharging = true;
/// weaponChargeStartTime = ctx.time;
/// }
/// }
/// fireAction.canceled +=
/// ctx =>
/// {
/// weaponCharging = false;
/// }
/// fireAction.performed +=
/// ctx =>
/// {
/// Fire();
/// weaponCharging = false;
/// }
///
///
///
/// By default, an action is started as soon as a control moves away from its default value. This is
/// the case for both actions (which, however, does not yet have to mean
/// that the button press threshold has been reached; see )
/// and actions. does not use
/// the Started phase and instead goes straight to .
///
/// For actions, Started will immediately be followed by .
///
/// Note that interactions (see ) can alter how an action does or does not progress through
/// the phases.
///
Started,
///
/// The action has been performed. Leads to getting called.
///
/// By default, a action performs when a control crosses the button
/// press threshold (see ), a
/// action performs on any value change that isn't the default value, and a
/// action performs on any value change including going back to the default value.
///
/// Note that interactions (see ) can alter how an action does or does not progress through
/// the phases.
///
/// For a given action, finding out whether it was performed in the current frame can be done with .
///
///
///
/// action.WasPerformedThisFrame();
///
///
///
Performed,
///
/// The action has stopped. Leads to getting called.
///
/// By default, a action cancels when a control falls back below the button
/// press threshold (see ) and a
/// action cancels when a control moves back to its default value. A action
/// does not generally cancel based on input on its controls.
///
/// An action will also get canceled when it is disabled while in progress (see ).
/// Also, when an that is
///
/// Note that interactions (see ) can alter how an action does or does not progress through
/// the phases.
///
Canceled
}
}