Exemplo n.º 1
0
    void Update()
    {
        _axes = new Vector2(Utilities.GetGoodAxis("Horizontal"), Utilities.GetGoodAxis("Vertical"));

        transform.localPosition   += (Vector3)_axes * speed * Time.deltaTime;
        transform.parent.position += transform.forward * _currentForwardSpeed * Time.deltaTime;

        ApplyForwardAcceleration();
        ApplyYawAndPitch();
        ApplyRoll();
        bounds.Constrain3DObject(transform);
        transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, 0f);

        FireTargettingRay();
        UpdateCrosshair();

        if (_cannonController)
        {
            if (Input.GetButton("Fire1"))
            {
                _cannonController.FireProjectile();
            }
            if (Input.GetButton("Fire2") && _currentTarget)
            {
                _cannonController.FireRocket(_currentTarget.transform);
            }
        }
    }