Build Shop

Shop now shows the current coins of the player
This commit is contained in:
brausjonas
2023-04-14 23:54:41 +02:00
parent 59b80c0ab2
commit 7e9d715574
5 changed files with 459 additions and 118 deletions
+3 -1
View File
@@ -8,17 +8,19 @@ public class ItemShop : MonoBehaviour
[SerializeField] private UIItem[] items;
public static Player currentPlayer = null;
[SerializeField] private TMP_Text textPlayerCoins;
public void Init(Player _currentPlayer)
{
currentPlayer = _currentPlayer;
textPlayerCoins.text = currentPlayer.coins + "";
}
private void Start()
{
foreach(UIItem ui in items)
{
TMP_Text text = ui.GetComponentInChildren<TMP_Text>();
TMP_Text text = ui.GetComponentsInChildren<TMP_Text>()[0];
text.text = ui.item.Cost + "";
}
}