43 lines
959 B
C#
43 lines
959 B
C#
using UnityEngine;
|
|
|
|
public class ScoreCardNumber : MonoBehaviour
|
|
{
|
|
private TMPro.TextMeshProUGUI tmp;
|
|
private RectTransform _rt;
|
|
private int _number = 0;
|
|
|
|
public int Number
|
|
{
|
|
get => _number;
|
|
set
|
|
{
|
|
_number = value;
|
|
tmp.text = _number.ToString();
|
|
}
|
|
}
|
|
|
|
public bool Enabled { get => this.gameObject.activeInHierarchy; set => this.gameObject.SetActive(value); }
|
|
|
|
private void Awake()
|
|
{
|
|
tmp = this.GetComponentInChildren<TMPro.TextMeshProUGUI>();
|
|
_rt = this.GetComponent<RectTransform>();
|
|
}
|
|
|
|
public void Initialize(Transform tran)
|
|
{
|
|
if (tran != null)
|
|
this.transform.SetParent(tran);
|
|
Number = 0;
|
|
this.Enabled = false;
|
|
}
|
|
|
|
|
|
public void SetParent(RectTransform rt)
|
|
{
|
|
this.transform.SetParent(rt);
|
|
this.transform.SetAsLastSibling();
|
|
_rt.anchoredPosition = Vector3.zero;
|
|
}
|
|
}
|