Files
brausjonas 7e9d715574 Build Shop
Shop now shows the current coins of the player
2023-04-14 23:54:41 +02:00

28 lines
645 B
C#

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
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.GetComponentsInChildren<TMP_Text>()[0];
text.text = ui.item.Cost + "";
}
}
}