/// <summary> /// Used to update the key bind with each tick of the Binds.Update function. /// </summary> public void UpdatePress(bool isPressed) { wasPressed = IsPressed; IsPressed = isPressed; if (IsNewPressed) { NewPressed?.Invoke(); stopwatch.Restart(); } if (IsPressed && stopwatch.ElapsedTicks > holdTime) { if (!IsPressedAndHeld) { PressedAndHeld?.Invoke(); } IsPressedAndHeld = true; } else { IsPressedAndHeld = false; } if (IsReleased) { Released?.Invoke(); } }
private void OnNewPressed() { NewPressed?.Invoke(this, EventArgs.Empty); }