Exemplo n.º 1
0
        void Update()
        {
            var hInput = Input.GetAxisRaw("Horizontal");
            var vInput = Input.GetAxisRaw("Vertical");

            var movementDirection = new Vector2(hInput, vInput).normalized;

            var newAiming = Input.GetButton("Fire2");

            if (newAiming != _isAiming)
            {
                _isAiming = newAiming;

                _cameraFollower.SwitchFollow(transform, _isAiming ? AimingCameraSize : CommonCameraSize);
            }

            var movementSpeedScale = _isAiming ? AimingMovementSpeedScale : 1;

            transform.Translate(movementDirection * MovementSpeed * Time.deltaTime * movementSpeedScale, Space.World);

            UpdateRotation(movementDirection);

            if (Input.GetButtonDown("Use"))
            {
                Interact();
            }

            if (Input.GetButtonDown("Fire1") && _isAiming)
            {
                _weapons[0].Shoot(transform.up);
            }
        }
Exemplo n.º 2
0
        public void ActivateCar(DriverController driver)
        {
            _switchManager.NotifySwitch(false);

            driver.DeactivateCharacter();
            enabled         = true;
            _turret.enabled = true;

            foreach (var wheel in _wheels)
            {
                wheel.enabled = true;
            }

            _cameraFollower.SwitchFollow(transform, CameraSize);
        }