Exemplo n.º 1
0
    private void Update()
    {
        if (!hasAuthority)
        {
            return;
        }
        if (_isDead)
        {
            _cannonController.AimHigh(Vector3.zero);
            return;
        }

        var input = JoystickInput.Left.CurrentJoystickDirection3;

        _chassisController.Move(input);

        // if (_joystickInput.CurrentJoystickDirection3 != Vector3.zero)
        // {
        // }
        // else
        // {
        //  _turretController.LookAt(transform.forward);
        // }
        _turretController.LookAt(JoystickInput.Right.CurrentJoystickDirection3);
        _cannonController.AimHigh(JoystickInput.Right.CurrentJoystickDirection3);

        if (Input.GetKeyDown(KeyCode.Space) || JoystickInput.Right.Released && JoystickInput.Right.CurrentJoystickDirection3.magnitude > InputMagnitudeForShotCancel)
        {
            _cannonController.Fire();
        }
        if (Input.GetKeyDown(KeyCode.V) || JoystickInput.Right.Pressed)
        {
            _teslaShield.Activate();
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            TakeDamage(Player, 20);
        }
    }