void ControllerAim() { if (mm) { if (mm.IsPaused) { return; } } //create position based on axis input and offset conHor = joystickAimInputHor.GetAxis(rawInputValues); conVer = -joystickAimInputVer.GetAxis(rawInputValues); //return if controller is not connected if (!JoystickInUse) { return; } lookHor = conHor * (rotSensitivity * 10) * Time.deltaTime; lookVer = conVer * (rotSensitivity * 10) * Time.deltaTime; if (invertY) { lookVer = -lookVer; } }
void MouseAim() { if (mm) { if (mm.IsPaused) { lookHor = 0; lookVer = 0; return; } } if (pl.IsDead) { return; } //get mouse position on screen mouseX = keyboardAimInputHor.GetAxis(rawInputValues); mouseY = -keyboardAimInputVer.GetAxis(rawInputValues); //return if controller is connected if (JoystickInUse) { return; } lookHor = mouseX * (rotSensitivity * 10) * Time.deltaTime; lookVer = mouseY * (rotSensitivity * 10) * Time.deltaTime; if (invertY) { lookVer = -lookVer; } }
protected override void OnEnter(NGNEntity _owner) { var inputHor = horInput.GetAxis(rawInputValues); var inputVer = verInput.GetAxis(rawInputValues); var move = new Vector3(inputHor, 0, inputVer).normalized; _owner.transform.Translate(move * speed * Time.deltaTime); }
protected virtual void GetInputs() { if (mm) { if (mm.IsPaused || pl.IsDead) { inputHor = 0; inputVer = 0; return; } } if (pl.IsDead) { return; } //movement axis input inputHor = horizontalInput.GetAxis(rawInputValues); inputVer = verticalInput.GetAxis(rawInputValues); inputLocalDirection = new Vector3(inputHor, 0, inputVer).normalized; if (rotationType == RotationType.AimControlled) { inputWorldDirection = transform.TransformDirection(inputLocalDirection); } else if (playerCamera) { var dir = playerCamera.transform.TransformDirection(inputLocalDirection); dir.y = 0; inputWorldDirection = dir.normalized; } if (climbing) { inputWorldDirection = new Vector3(inputWorldDirection.x, inputWorldDirection.z, 0); } if (forwardZMovementOnly) { inputWorldDirection.z = Mathf.Clamp(inputWorldDirection.z, 0, Mathf.Infinity); } if (controllerType == BaseControllerType.CharacterController) { if (!climbing) { movementInput = new Vector3(inputWorldDirection.x, curVerticalForce, inputWorldDirection.z); } else { movementInput = inputWorldDirection; } } else if (controllerType == BaseControllerType.Rigidbody) { if (!controlFading) { movementInput = inputWorldDirection; } } //run input run.Value = Input.GetButton(runButton.stringValue); //jump input jump = jumpButton.GetInputDown() && enableJump; if (jump) { Jump(); } //crouch input if (Input.GetButtonDown(crouchButton.stringValue)) { if (toggleCrouch) { crouch.Value = !crouch.Value; } else { crouch.Value = true; } } if (Input.GetButtonUp(crouchButton.stringValue) && !toggleCrouch) { crouch.Value = false; } //dash input if (enableDash) { if (dashButton.GetInputDown()) { Dash(); } } //roll input if (enableRoll) { if (rollButton.GetInputDown()) { Roll(); } } }