using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class ScoreboardManagerScript : MonoBehaviour {

    private Text _scoreText;

    void Awake() {
        this._scoreText = GameObject.FindGameObjectWithTag("ScoreText").GetComponent<Text>();
        this._scoreText.text = "0";
    }

    public void IncreaseScore(float amount) {
        this.Score += amount;
    }
    public float Score {
        get {
            float score;
            if (float.TryParse(this._scoreText.text, out score)) {
                return score;
            } else {
                return -1f;
            }
        }
        set {
            if (value <= 0) {
                this._scoreText.text = "0";
            } else {
                this._scoreText.text = value.ToString();
            
            }
        }
    }
}
