view Assets/Application/Scripts/ItemCanvas.cs @ 3:2dd40b4412e4

Create game base.
author Kazuma
date Mon, 07 Nov 2016 18:42:01 +0900
parents
children
line wrap: on
line source

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

public class ItemCanvas : MonoBehaviour {
	public GameObject ItemImage;
	private Text[] itemText = new Text[3];

	public void Start () {
		for (int i = 0; i < 3; i++) {
			itemText [i] = this.transform.GetChild (i).gameObject.GetComponentInChildren<Text>();
		}
		Player.Instance.SetCallback (ChangeCount);
	}
	public void ChangeCount (int sand, int wood, int glass) {
		itemText [0].text = sand.ToString ();
		itemText [1].text = wood.ToString ();
		itemText [2].text = glass.ToString ();
	}
}