25 lines
642 B
C#
25 lines
642 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class TextBox : MonoBehaviour
|
|
{
|
|
public Text numText;
|
|
public Transform ParentHouse;
|
|
public Transform Parent;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
transform.SetParent(Parent);//¸Ä±ä¸¸½Úµã£¬ÏÔʾ³öÀ´
|
|
numText = transform.Find("Text").GetComponent<Text>();
|
|
SetText(0);
|
|
}
|
|
|
|
public void SetText(float add)
|
|
{
|
|
ParentHouse.GetComponent<HouseInfo>().Money += add;
|
|
numText.text = ParentHouse.GetComponent<HouseInfo>().Money.ToString();
|
|
}
|
|
}
|