示例#1
0
    private void SetTextData(float targetDistance, ShootHistory history)
    {
        if (targetDistanceText != null)
        {
            targetDistanceText.text = targetDistance.ToString() + "m";
        }

        if (shotDistanceText != null)
        {
            shotDistanceText.text = history.GetShotDistance().ToString() + "m";
        }

        if (cannonballText != null)
        {
            cannonballText.text = history.GetCannonBall() + "m";
        }

        if (powderText != null)
        {
            powderText.text = history.GetPowder().ToString() + "m";
        }

        if (angleText != null)
        {
            angleText.text = history.GetAngle().ToString() + "m";
        }
    }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        if (cannonController.IsCannonBallLoaded)
        {
            cannonBallText.text = "Loaded";
        }
        else
        {
            cannonBallText.text = "NONE";
        }

        cannonAngleText.text = cannonController.GetCannonAngle() + "%";

        powderText.text = cannonController.GetPowder() + " g";
        ShootHistory shootHistory = SceneManager.Instance.GetLastShoot();

        if (shootHistory != null)
        {
            displayText.text = "Last Shoot: Angle = " + shootHistory.GetAngle() + " Cannonball = " + shootHistory.GetCannonBall() + " Gunpowder = " + shootHistory.GetPowder() + " Shoot Distance = " + shootHistory.GetShotDistance();
        }
    }