void HandleAnimations() { playerAnimation.Movement(charController.velocity.magnitude); playerAnimation.PlayerJump(charController.velocity.y); if (is_Crouching && charController.velocity.magnitude > 0f) { playerAnimation.PlayerCrouchWalk(charController.velocity.magnitude); } // SHOOTING if (Input.GetMouseButtonDown(0) && Time.time > nextTimeToFire) { nextTimeToFire = Time.time + 1f / fireRate; if (is_Crouching) { playerAnimation.Shoot(false); } else { playerAnimation.Shoot(true); } current_Weapon.Shoot(); } if (Input.GetKeyDown(KeyCode.R)) { playerAnimation.Reload(); } }
void HandleAnimation() { playerAnimation.Movement(charController.velocity.magnitude); playerAnimation.PlayerJump(charController.velocity.y); if (is_Crouching && charController.velocity.magnitude > 0f) { playerAnimation.PlayerCrouchWalk(charController.velocity.magnitude); } }
private void HandleAnimation() { playerAnimation.Movement(charController.velocity.magnitude); playerAnimation.PlayerJump(charController.velocity.y); if (isCrouching && charController.velocity.magnitude > 0f) { playerAnimation.PlayerCrouchWalk(charController.velocity.magnitude); } #region HandleShootingInformation if (currentWeapon.name == "deagle") { if (Input.GetMouseButtonDown(0) && Time.time > nextTimeToFire) { if (currentWeapon.bulletLeft > 0 && !isReloading) { nextTimeToFire = Time.time + 1f / fireRate; playerAnimation.Shoot(!isCrouching); currentWeapon.Shoot(); currentHandsWeapon.Shoot(); } } } else { if (Input.GetMouseButton(0) && Time.time > nextTimeToFire) { if (currentWeapon.bulletLeft > 0 && !isReloading) { nextTimeToFire = Time.time + 1f / fireRate; playerAnimation.Shoot(!isCrouching); currentWeapon.Shoot(); currentHandsWeapon.Shoot(); } } } if (Input.GetKeyDown(KeyCode.R)) { if (!isReloading) { isReloading = true; reloadTimeRemain = currentWeapon.reloadTime; if (currentWeapon.bulletCapacity >= currentWeapon.cartridge - currentWeapon.bulletLeft) { currentWeapon.bulletCapacity -= currentWeapon.cartridge - currentWeapon.bulletLeft; currentWeapon.bulletLeft = currentWeapon.cartridge; } else if (currentWeapon.bulletCapacity > 0) { currentWeapon.bulletLeft = currentWeapon.bulletCapacity; } else { print("Ammo empty"); } playerAnimation.ReloadGun(); currentHandsWeapon.Reload(); } } #endregion }