using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; public class UIManager : MonoBehaviour { [Header("Stat Text Objects")] public List m_StatText; public TMP_Text m_ModelNameText; private void OnEnable() { DReConRewards.m_UpdateStat += UpdateStatText; ModelManager.m_UpdateModelName += UpdateModelName; } private void OnDisable() { DReConRewards.m_UpdateStat -= UpdateStatText; ModelManager.m_UpdateModelName -= UpdateModelName; } private void UpdateStatText(float reward, int statIndex) { try { m_StatText[statIndex].text = reward.ToString("#.000"); } catch { Debug.LogError($"Text object did not exist index: {statIndex}"); } } private void UpdateModelName(float modelName) { if( m_ModelNameText != null ) { m_ModelNameText.text = modelName.ToString("N0"); } } }