Exemple #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";
        }
    }
Exemple #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();
        }
    }
Exemple #3
0
 public void OnTargetHit(ShootHistory history)
 {
     // Update Text fields
     SetTextData(SceneManager.Instance.GetTargetDistance(), history);
 }
Exemple #4
0
 public void CannonShot(float angle, float powder, string cannonBall)
 {
     lastShootHistory = new ShootHistory(angle, powder, cannonBall);
 }