public void Shoot(PlayerShooter shooter) { if (GameManager.isRestarting == false && !GameManager.GameIsPaused && !GameManager.playerPauseTheGame) { if (shooter.currentWeapon.FireRate <= 0f) { if (Input.GetButtonDown("Fire1")) { shooter.Shoot(); } } else { if (Input.GetButtonDown("Fire1")) { shooter.ShootRepeating(); } else if (Input.GetButtonUp("Fire1")) { shooter.CancelShoot(); } } } else { shooter.CancelShoot(); } }
private void OnShootActionCancelled(InputAction.CallbackContext ctx) { if (_shotProgressBar.currentFill > 0.1f) { _shooter.Shoot(_shotProgressBar.currentFill); _playerAnimator.Shoot(); _playerAudio.Shoot(); } else { _playerAnimator.Walk(); } _shotProgressBar.StopAndReset(); _isSwinging = false; }
private void Update() { if (isLocalPlayer && !playerHealth.IsDead) { if (Input.GetMouseButtonDown(0)) { playerShooter.Shoot(); } UpdateInput(); playerMotor.RotateChassis(inputDirection); Vector3 turretDirection = Utility.ScreenToElevatedWorldPoint( Input.mousePosition, playerMotor.TurretTransform.position.y) - playerMotor.TurretTransform.position; playerMotor.RotateTurret(turretDirection); } }