public void Process(ref InputInteractionContext context) { var isActuated = context.ControlIsActuated(pressPointOrDefault); switch (behavior) { case PressBehavior.PressOnly: if (m_WaitingForRelease) { if (!isActuated) { m_WaitingForRelease = false; // We need to reset the action to waiting state in order to stop it from triggering // continuously. However, we do not want to cancel here as that will trigger the action. // So go back directly to waiting here. context.Waiting(); } } else if (isActuated) { context.Started(); context.Performed(); m_WaitingForRelease = true; } break; case PressBehavior.ReleaseOnly: if (m_WaitingForRelease && !isActuated) { m_WaitingForRelease = false; context.Performed(); } else if (isActuated) { context.Started(); m_WaitingForRelease = true; } break; case PressBehavior.PressAndRelease: if (m_WaitingForRelease) { if (!isActuated) { context.Started(); context.Performed(); } m_WaitingForRelease = isActuated; } else if (isActuated) { context.Started(); context.Performed(); m_WaitingForRelease = true; } break; } }