chip-gameV3/Assets/Scripts/Menu/GamemodePriceLabel.cs

20 lines
471 B
C#

using TMPro;
using UnityEngine;
[RequireComponent (typeof(TextMeshProUGUI))]
public class GamemodePriceLabel : MonoBehaviour
{
[SerializeField] private GameMode _gameMode;
private TextMeshProUGUI _label;
void Start()
{
_label = GetComponent<TextMeshProUGUI>();
UpdatePrice();
PaymentSystem.OnPaymentDataChanged += UpdatePrice;
}
private void UpdatePrice() => _label.text = PaymentSystem.GetPriceString(_gameMode);
}