void Update() { Vector3 angle = parentController.localEulerAngles; input.blockRotationPlayer = Input.GetMouseButton(0); bool pressing = Input.GetMouseButton(0); if (Input.GetMouseButton(0)) { VisualPolish(); input.RotateToCamera(transform); } if (Input.GetMouseButtonDown(0)) { inkParticle.Play(); } else if (Input.GetMouseButtonUp(0)) { inkParticle.Stop(); } parentController.localEulerAngles = new Vector3(Mathf.LerpAngle(parentController.localEulerAngles.x, pressing ? RemapCamera(freeLookCamera.m_YAxis.Value, 0, 1, -25, 25) : 0, .3f), angle.y, angle.z); }
// Update is called once per frame void Update() { if (aiming) { input.RotateToCamera(transform); } else { transform.eulerAngles = new Vector3(Mathf.LerpAngle(transform.eulerAngles.x, 0, 0.2f), transform.eulerAngles.y, transform.eulerAngles.z); } anim.SetBool("pulling", pulling); walking = input.Speed > 0; anim.SetBool("walking", walking); if (Input.GetMouseButtonDown(1) && hasWeapon) { Aim(true, true, 0); } if (Input.GetMouseButtonUp(1) && hasWeapon) { Aim(false, true, 0); } if (hasWeapon) { if (aiming && Input.GetMouseButtonDown(0)) { anim.SetTrigger("throw"); } } else { if (Input.GetMouseButtonDown(0)) { WeaponStartPull(); } } if (pulling) { if (returnTime < 1) { weapon.position = GetQuadraticCurvePoint(returnTime, pullPosition, curverPoint.position, hand.position); returnTime += Time.deltaTime * 1.5f; } else { WeaponCatch(); } } if (Input.GetKeyDown(KeyCode.R)) { SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().name); } }
void Update() { //If aiming rotate the player towards the camera foward, if not reset the camera rotation on the x axis if (aiming) { input.RotateToCamera(transform); } else { transform.eulerAngles = new Vector3(Mathf.LerpAngle(transform.eulerAngles.x, 0, .2f), transform.eulerAngles.y, transform.eulerAngles.z); } //Animation States animator.SetBool("pulling", pulling); walking = input.Speed > 0; animator.SetBool("walking", walking); if (Input.GetMouseButtonDown(1) && hasWeapon) { Aim(true, true, 0); } if (Input.GetMouseButtonUp(1) && hasWeapon) { Aim(false, true, 0); } if (hasWeapon) { if (aiming && Input.GetMouseButtonDown(0) && playerObject.GetComponent <PlayerStats>().playerSpecial >= 25) { playerObject.GetComponent <PlayerStats>().playerSpecial -= 25; animator.SetTrigger("throw"); } } else { if (Input.GetMouseButtonDown(0)) { WeaponStartPull(); } } if (pulling) { if (returnTime < 1) { weapon.position = GetQuadraticCurvePoint(returnTime, pullPosition, curvePoint.position, hand.position); returnTime += Time.deltaTime * 1.5f; } else { WeaponCatch(); } } if (Input.GetKeyDown(KeyCode.R)) { SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().name); } }