using System; using TMPro; using UnityEngine; using UnityEngine.UI; public class CollectBtn : MonoBehaviour { public DateTime lastCollected; public float productionRate; public double collectableAmount; public Button btn; public TMP_Text txt; void Update() { collectableAmount=((DateTime.Now - lastCollected).TotalSeconds * productionRate); txt.text = ((int)collectableAmount).ToString(); btn.interactable = collectableAmount > 1; } public void Set(DateTime _lastCollected, float _productionRate){ lastCollected = _lastCollected; productionRate=_productionRate; } }