private void GrabMouseSelect(InputAction.CallbackContext ctx) { if (ctx.ReadValueAsButton() == false && didMouseClick == true) { currHealth++; } didMouseClick = ctx.ReadValueAsButton(); }
public void OnSecondaryMouseButtonAction(InputAction.CallbackContext context) { // Listen for right mouse button press and release. if (context.ReadValueAsButton() && !context.performed) { RightClicked?.Invoke(ScreenLocation); } else if (!context.ReadValueAsButton()) { RightReleased?.Invoke(ScreenLocation); } }
/// <summary> /// Used by the Unity Input System to invoke on clicked behaviour. /// </summary> /// <param name="context">The input action context.</param> public void RecieveClicked(InputAction.CallbackContext context) { // Is the mouse button down or up? if (context.ReadValueAsButton() && !context.performed) { OnClicked(); } else if (!context.ReadValueAsButton()) { OnReleased(); } }
private void OnJumpPressed(InputAction.CallbackContext obj) { //Wall Jump if (obj.ReadValueAsButton()) { Vector2 _jumpVelocity = Vector2.zero; if (WallDirection == RawInputX) { _jumpVelocity.x = -WallDirection * PlayerData.WallJumpClimb.x; _jumpVelocity.y = PlayerData.WallJumpClimb.y; } else if (RawInputX == 0f) { _jumpVelocity.x = -WallDirection * PlayerData.WallJumpOff.x; _jumpVelocity.y = PlayerData.WallJumpOff.y; } else { _jumpVelocity.x = -WallDirection * PlayerData.WallJumpLeap.x; _jumpVelocity.y = PlayerData.WallJumpLeap.y; } PlayerController.SetVelocity(_jumpVelocity); PlayerController.CheckIfShouldFlip(_jumpVelocity.x); PlayerController.AnimController.PlayAnimation(AnimationConstants.PLAYER_JUMP_HASH); StateMachine.ChangeState(PlayerController.InAirState); } }
private void OnAttackPressed(InputAction.CallbackContext obj) { if (obj.ReadValueAsButton()) { StateMachine.ChangeState(PlayerController.AirAttackState); } }
void TranslateToAction(InputAction.CallbackContext cc) { if (cc.ReadValueAsButton()) { action?.Invoke(); } }
private void OnJumpPressed(InputAction.CallbackContext context) { if (context.ReadValueAsButton() && !ObstacleAbove) { StateMachine.ChangeState(PlayerController.JumpState); } }
public void OnInputReceived(GamepadInput input, InputAction.CallbackContext context) { switch (input) { case GamepadInput.LeftStick: moveInput = context.action.ReadValue <Vector2>(); UpdateMoveInput(); break; case GamepadInput.SouthButton: if (context.started) { interactAbility.Interact(); } break; case GamepadInput.NorthButton: if (context.started) { jumpAbility.StartJump(); } else if (context.canceled) { jumpAbility.EndJump(); } break; case GamepadInput.RightTrigger: moveAbility.SetIsRunning(context.ReadValueAsButton()); break; } }
public void OnExitButtonAction(InputAction.CallbackContext context) { if (context.ReadValueAsButton() && !context.performed) { ExitPressed?.Invoke(); } }
void OnJump(InputAction.CallbackContext ctx) { if (ctx.ReadValueAsButton() && IsGrounded()) { Jump(); } }
public void OnDash(InputAction.CallbackContext context) { if (context.started || context.canceled || context.performed) { bool dashing = context.ReadValueAsButton(); _charController.Dash(dashing); } }
protected void OnAttackPressed(InputAction.CallbackContext obj) { if (obj.ReadValueAsButton()) { _inputRegistered = true; _inputTimer = 0f; } }
private void OnJumpPressed(InputAction.CallbackContext obj) { if (obj.ReadValueAsButton() && PlayerController.CurrentVelocity.y < 0f) { if (PlayerController.JumpState.CanJumpAgain() && !_isTouchingWall) { StateMachine.ChangeState(PlayerController.JumpState); } } }
/// <summary> /// Get back to previous screen /// </summary> /// <param name="callbackContext"> Context with parameters </param> public void OnCancel(InputAction.CallbackContext callbackContext) { if (callbackContext.performed && callbackContext.ReadValueAsButton()) { if (panel.activeSelf) { SaveAndBackToMainMenu(); } } }
/// <summary> /// Pause or resume current game /// </summary> /// <param name="callbackContext"> Context with parameters </param> public void OnPause(InputAction.CallbackContext callbackContext) { if (callbackContext.performed && callbackContext.ReadValueAsButton()) { if (CanPause) { PauseOrResumeGame(); } } }
public void UpdateValues(InputAction.CallbackContext context) { if (_value) { _value.Value = context.ReadValue <T>(); } if (_valueAsButton) { _valueAsButton.Value = context.ReadValueAsButton(); } }
public override void OnSubmitPressed(InputAction.CallbackContext context) { if (context.phase == InputActionPhase.Started && context.ReadValueAsButton()) { if (!DialogueManager.Instance.canvas.TrySkipTypewriterAnimation() && !DialogueManager.Instance.canvas.TryAdvanceText()) { DialogueGraph.ExecuteNextNode(); } } }
private void HardResetPuzzle(InputAction.CallbackContext ctx) { if (canToggleBetween && ctx.ReadValueAsButton()) { if (playerController.CurrentState == PlayerStates.PUZZLE) { associatedPuzzleMode.ResetMode(true); playerController.ReturnToPlatformMode(); } } }
/// <summary> /// Get back to previous screen /// </summary> /// <param name="callbackContext"> Context with parameters </param> public void OnCancel(InputAction.CallbackContext callbackContext) { if (callbackContext.performed && callbackContext.ReadValueAsButton()) { if (!panel.activeSelf || isEditingAudio) { return; } GetBackToMainMenu(); } }
/// <summary> /// Get back to previous screen /// </summary> /// <param name="callbackContext"> Context with parameters </param> public void OnCancel(InputAction.CallbackContext callbackContext) { if (callbackContext.performed && callbackContext.ReadValueAsButton()) { if (!panel.activeSelf || SelectLevelsPanelController.Instance.ActualGameState != Enumerators.GameStates.GAMEPLAY) { return; } Close(); } }
private void ToggleMode(InputAction.CallbackContext ctx) { if (canToggleBetween && ctx.ReadValueAsButton()) { if (playerController.CurrentState == PlayerStates.PLATFORM) { associatedPuzzleMode.gameObject.SetActive(true); playerController.SwitchToPuzzleMode(); } else { associatedPuzzleMode.ResetMode(false); playerController.ReturnToPlatformMode(); } } }
private void FastFall(InputAction.CallbackContext ctx) { if (currPiece != null) { bool prevVal = isFastFall; isFastFall = ctx.ReadValueAsButton(); if (prevVal == false && isFastFall == true) { beforeFastFally = currPiece.velocity.y; } else if (prevVal == true && isFastFall == false) { currPiece.velocity = new Vector2(currPiece.velocity.x, beforeFastFally); } } }
/// <summary> /// Get back to previous screen /// </summary> /// <param name="callbackContext"> Context with parameters </param> public void OnCancel(InputAction.CallbackContext callbackContext) { if (callbackContext.performed && callbackContext.ReadValueAsButton()) { if (questionObject.activeSelf) { DontResetProgress(true); return; } if (panel.activeSelf) { AudioController.Instance.PlaySFX(AudioController.Instance.UiCancelSound, AudioController.Instance.MaxSFXVolume); TogglePanel(false); MainMenuPanelController.Instance.TogglePanel(true); return; } } }
protected override void OnInputUpdate(InputAction.CallbackContext context) { if (value != (value = context.ReadValue <float>())) { onChange.Invoke(value); } if (pressed != (pressed = context.ReadValueAsButton())) { onStateChange.Invoke(pressed); if (pressed) { onPress.Invoke(); } else { onRelease.Invoke(); } } }
private void OnJump(InputAction.CallbackContext context) { bool pressed = context.ReadValueAsButton(); if (pressed) { if (context.phase == InputActionPhase.Started) { m_Jump = ButtonState.JustPressed; } else { m_Jump = ButtonState.Pressed; } } else { m_Jump = ButtonState.Released; } }
/// <summary> /// Called by unity's input system when a submit button is pressed. /// </summary> /// <param name="context">The callback context.</param> public void OnSubmit(InputAction.CallbackContext context) { if (!SceneManager.GetActiveScene().isLoaded) { return; } if (!context.performed || MenuManager.Current.name == "MenuPlaying") { return; } bool isPressed = context.ReadValueAsButton(); if (isPressed && MenuManager.Current.CurrentSelectable is Button button) { PointerEventData pointerData = GetMousePointerEventData(); button.OnPointerClick(pointerData); AudioManager.Play(ScrollAudioClip, AudioCategory.Effect, 0.55f); } }
public override void OnClick(InputAction.CallbackContext context) { if (!turnTaker.turn || !context.ReadValueAsButton()) { return; // Only want mouse-down } var ray = Camera.main.ScreenPointToRay(Mouse.current.position.ReadValue()); if (!Physics.Raycast(ray, out var hit) || !hit.collider.CompareTag("Tile")) { return; } var t = hit.collider.GetComponent <Tile>(); if (!t.selectable) { return; } StartMove(t); }
public void OnJump(InputAction.CallbackContext context) { _jump = context.ReadValueAsButton(); }
public void Set(InputAction.CallbackContext context) => value = context.ReadValueAsButton();
void OnAddGreenAppleInput(InputAction.CallbackContext context) { IsAddGreenApplePressed = context.ReadValueAsButton(); }