Exemple #1
0
 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();
     }
 }
Exemple #2
0
    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;
    }
Exemple #3
0
    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);
        }
    }