private void Awake() { controls = new PlayerControls(); groundMove = controls.GroundMovement; groundMove.HorizontalMovement.performed += ctx => horizontalInput = ctx.ReadValue <Vector2>(); groundMove.MouseX.performed += ctx => mouseInput.x = ctx.ReadValue <float>(); groundMove.MouseY.performed += ctx => mouseInput.y = ctx.ReadValue <float>(); groundMove.Interact.performed += _ => playerRaycast.InteractPressed(); }
private void Awake() { Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; _controls = new PlayerControls(); _groundMovement = _controls.GroundMovement; // _groundMovement.[action].performed += context => do something _groundMovement.HorizontalMovement.performed += ctx => _horizontalInput = ctx.ReadValue <Vector2>(); _groundMovement.Jump.performed += _ => _movement.OnJumpPressed(); _groundMovement.MouseX.performed += ctx => _mouseInput.x = ctx.ReadValue <float>(); _groundMovement.MouseY.performed += ctx => _mouseInput.y = ctx.ReadValue <float>(); _groundMovement.Sprint.performed += ctx => _movement.OnSprintPressed(ctx.ReadValueAsButton()); _groundMovement.Fire.performed += ctx => _weapon.OnFirePressed(ctx.ReadValueAsButton()); }