mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-19 23:37:13 +08:00
Co-authored-by: m0_75251201 <m0_75251201@noreply.gitcode.com> Reviewed-on: http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite/pulls/60
27 lines
650 B
C#
27 lines
650 B
C#
using Entity;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
namespace UI
|
|
{
|
|
public class CoinCountUI : MonoBehaviour
|
|
{
|
|
public TMP_Text text;
|
|
public int coinCount;
|
|
|
|
private void Start()
|
|
{
|
|
text.text = coinCount.ToString();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
var playerEntity = Program.Instance.FocusedEntity as Character;
|
|
if (!playerEntity || playerEntity.Coin == null)
|
|
return;
|
|
if (coinCount == playerEntity.Coin.Quantity) return;
|
|
coinCount = playerEntity.Coin.Quantity;
|
|
text.text = coinCount.ToString();
|
|
}
|
|
}
|
|
} |