////TODO: make sure 2d doesn't move too far public void Process(ref InputAction.ModifierContext context) { if (context.timerHasExpired) { context.Cancelled(); return; } if (context.isWaiting && !context.controlHasDefaultValue) { m_TapStartTime = context.time; context.SetTimeout(durationOrDefault); context.Started(); return; } if (context.isStarted && context.controlHasDefaultValue) { if (context.time - m_TapStartTime <= durationOrDefault) { context.Performed(); } else { ////REVIEW: does it matter to cancel right after expiration of 'duration' or is it enough to cancel on button up like here? context.Cancelled(); } } }
public void Process(ref InputAction.ModifierContext context) { if (context.timerHasExpired) { context.Performed(); return; } if (context.isWaiting && !context.controlHasDefaultValue) { m_TimePressed = context.time; context.Started(); context.SetTimeout(durationOrDefault); return; } ////TODO: need to ignore releases on controls that aren't m_PressedControl if (context.isStarted && context.controlHasDefaultValue) { if (context.time - m_TimePressed >= durationOrDefault) { context.Performed(); } else { context.Cancelled(); } } }
public void Process(ref InputAction.ModifierContext context) { if (!context.isWaiting) { return; } var control = context.control; var button = control as ButtonControl; if (button != null) { ////REVIEW: ths may not work as desired if multiple button state changes happen in the same update if (button.wasJustPressed) { context.Performed(); } } else { // Essentially replicate the button press logic from ButtonControl here. var floatControl = control as InputControl <float>; if (floatControl != null) { var value = floatControl.value; var previous = floatControl.previous; var pressPoint = InputConfiguration.ButtonPressPoint; if (previous < pressPoint && value >= pressPoint) { context.Performed(); } } } }
public void Process(ref InputAction.ModifierContext context) { if (!context.isWaiting) { return; } var control = context.control; var button = control as ButtonControl; if (button != null) { if (button.wasJustPressed) { context.Performed(); } } else { // Essentially replicate the button press logic from ButtonControl here. var floatControl = control as InputControl <float>; if (floatControl != null) { var value = floatControl.value; var previous = floatControl.previous; var pressPoint = InputConfiguration.ButtonPressPoint; if (previous < pressPoint && value >= pressPoint) { context.Performed(); } } } }
public void Process(ref InputAction.ModifierContext context) { throw new System.NotImplementedException(); }