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

public class Scorer : MonoBehaviour {
	public int score;
	public string cashScale = "000000000";
	public double money;
	public string label;
	public int count;
	Text text;

	// Use this for initialization
	void Start () {
		text = GetComponent <Text> ();
		print("start " + gameObject.name + " " + gameObject.guiText.text);
		score = 0;
		count = 0;
		money = 0;
		label = "SURPLUS: $";
		text.text = label + score;
	}

	public void ShouldUpdateScore()
	{
		print ("play sound");
		gameObject.audio.Play();
		score = score + Random.Range(1,7);
		text.text = label + score + cashScale;
	}

	// Update is called once per frame
	void Update () {
		//gameObject.guiText.text = label + score;

		/* int scorer */

/*		if (score > 0)
		{
			text.text = label + score + cashScale;
		}
		else
		{
			text.text = label + score;
		}*/

		/* TODO: change money to be more realistic
		text.text = label + money; */

		//print("update " + gameObject.name + " " + gameObject.guiText.text);
	}


}
