_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Battle_Royale/TextBox.cs
2024-11-13 18:01:18 +08:00

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();
}
}