Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCS: Adding docs for methods in InputInteractionContext (DOCF-4371) #1999

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ public bool ControlIsActuated(float threshold = 0)
/// Mark the interaction has having begun.
/// </summary>
/// <remarks>
/// Note that this affects the current interaction only. There may be multiple interactions on a binding
/// and arbitrary many interactions may concurrently be in started state. However, only one interaction
/// This affects the current interaction only. There might be multiple interactions on a binding
/// and arbitrary many interactions might concurrently be in started state. However, only one interaction
/// (usually the one that starts first) is allowed to drive the action's state as a whole. If an interaction
/// that is currently driving an action is canceled, however, the next interaction in the list that has
/// been started will take over and continue driving the action.
Expand Down Expand Up @@ -161,13 +161,32 @@ public void Started()
m_State.ChangePhaseOfInteraction(InputActionPhase.Started, ref m_TriggerState);
}

/// <summary>
/// Marks the interaction as being performed and then transitions back to <see cref="InputActionPhase.Waiting"/>
/// to wait for input. This behavior is desirable for interaction events that are instant and reflect
/// a transitional interaction pattern such as <see cref="Interactions.PressInteraction"/> or <see cref="Interactions.TapInteraction"/>.
/// </summary>
/// <remarks>
/// Note that this affects the current interaction only. There might be multiple interactions on a binding
/// and arbitrary many interactions might concurrently be in started state. However, only one interaction
/// (usually the one that starts first) is allowed to drive the action's state as a whole. If an interaction
/// that is currently driving an action is canceled, however, the next interaction in the list that has
/// been started will take over and continue driving the action.
/// </remarks>
public void Performed()
{
if (m_TriggerState.phase == InputActionPhase.Waiting)
m_TriggerState.startTime = time;
m_State.ChangePhaseOfInteraction(InputActionPhase.Performed, ref m_TriggerState);
}


/// <summary>
/// Marks the interaction as being performed and then transitions into I <see cref="InputActionPhase.Started"/>
/// to wait for an initial trigger condition to be true before being performed again. This behavior
/// may be desirable for interaction events that reflect transitional interaction patterns but should
/// be considered as started until a cancellation condition is true, such as releasing a button.
/// </summary>
public void PerformedAndStayStarted()
{
if (m_TriggerState.phase == InputActionPhase.Waiting)
Expand All @@ -176,6 +195,12 @@ public void PerformedAndStayStarted()
phaseAfterPerformed: InputActionPhase.Started);
}

/// <summary>
/// Marks the interaction as being performed and then stays in that state waiting for an input to
/// cancel the interactions active state. This behavior is desirable for interaction events that
/// are active for a duration until a cancellation condition is true, such as <see cref="Interactions.HoldInteraction"/> or <see cref="Interactions.TapInteraction"/> where releasing
/// the associated button cancels the interaction..
/// </summary>
public void PerformedAndStayPerformed()
{
if (m_TriggerState.phase == InputActionPhase.Waiting)
Expand All @@ -184,6 +209,16 @@ public void PerformedAndStayPerformed()
phaseAfterPerformed: InputActionPhase.Performed);
}

/// <summary>
/// Marks the interaction as being interrupted or aborted. This is relevant to signal that the interaction
/// pattern was not completed, for example, the user pressed and then released a button before the minimum
/// time required for a <see cref="Interactions.HoldInteraction"/> to complete.
/// </summary>
/// <remarks>
/// This is used by most existing interactions to cancel the transitions in the interaction state machine
/// when a condition required to proceed turned false or other indirect requirements were not met, such as
/// time-based conditions.
/// </remarks>
public void Canceled()
{
if (m_TriggerState.phase != InputActionPhase.Canceled)
Expand Down