// Update is used to set features regardless the active behaviour. void Update() { // Activate/deactivate aim by input. if (Input.GetAxisRaw(aimButton) != 0 && !aim) { StartCoroutine(ToggleAimOn()); } else if (aim && Input.GetAxisRaw(aimButton) == 0) { StartCoroutine(ToggleAimOff()); } // No sprinting while aiming. canSprint = !aim; // Toggle camera aim position left or right, switching shoulders. if (aim && Input.GetButtonDown(shoulderButton)) { aimCamOffset.x = aimCamOffset.x * (-1); aimPivotOffset.x = aimPivotOffset.x * (-1); } // Set aim boolean on the Animator Controller. behaviourManager.GetAnim.SetBool(aimBool, aim); // Weapon control if (weapon != null) { if (aim) { weapon.weaponAim(true); } else { weapon.weaponAim(false); } if (Input.GetButton("Fire1")) { weapon.Fire(); } } }