3
|
1 using UnityEngine;
|
|
2 using System.Collections;
|
|
3 using UnityEngine.UI;
|
|
4
|
|
5 public class ItemCanvas : MonoBehaviour {
|
|
6 public GameObject ItemImage;
|
|
7 private Text[] itemText = new Text[3];
|
|
8
|
|
9 public void Start () {
|
|
10 for (int i = 0; i < 3; i++) {
|
|
11 itemText [i] = this.transform.GetChild (i).gameObject.GetComponentInChildren<Text>();
|
|
12 }
|
|
13 Player.Instance.SetCallback (ChangeCount);
|
|
14 }
|
|
15 public void ChangeCount (int sand, int wood, int glass) {
|
|
16 itemText [0].text = sand.ToString ();
|
|
17 itemText [1].text = wood.ToString ();
|
|
18 itemText [2].text = glass.ToString ();
|
|
19 }
|
|
20 }
|