29 lines
698 B
C#
29 lines
698 B
C#
using System;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class PointsUI : MonoBehaviour {
|
|
[SerializeField] private TextMeshProUGUI pointsText;
|
|
public static PointsUI Instance { get; private set; }
|
|
|
|
private void Awake() {
|
|
Instance = this;
|
|
}
|
|
|
|
private void Start() {
|
|
DeliveryManager.Instance.OnRecipeCompleted += DeliveryManager_OnRecipeCompleted;
|
|
Show();
|
|
}
|
|
|
|
private void DeliveryManager_OnRecipeCompleted(object sender, EventArgs e) {
|
|
pointsText.text = $"Points: {DeliveryManager.Instance.Points}";
|
|
}
|
|
|
|
public void Hide() {
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
public void Show() {
|
|
gameObject.SetActive(true);
|
|
}
|
|
} |