Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        //If player left-clicks add force
        if (Input.GetMouseButtonDown(0) && (levelManagerScript == null || !levelManagerScript.GetMouseOverUI()))
        {
            if (!ballManagerScript.getBallMoving())
            {
                scoreKeepingScript.addToHits();

                //Scales arrow scale percent to force
                float force, forceCurve;
                force = arrowScalePercent * (MAX_POWER - MIN_POWER) + MIN_POWER;

                forceCurve = 2750 * force + 300;

                ballManagerScript.startCameraAnimationAndForce(forceCurve);
            }
        }
        //If the player does not left click then this updates the dirction the ball faces and the arrow.
        else
        {
            if (!ballManagerScript.getBallMoving() && !cameraFollowScript.getFullScreenAnimation() && !cameraFollowScript.getFullScreen() && !ballManagerScript.GetWin())
            {
                v3_transform = UpdateFacingDirection();

                transform.LookAt(-v3_transform);
                transform.rotation = Quaternion.Euler(new Vector3(0, transform.rotation.eulerAngles.y, 0));

                UpdateArrow(v3_transform);
                canvasArrow.enabled = true;
            }
            else
            {
                canvasArrow.enabled = false;
            }
        }
    }