using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TMPro; using Michsky.MUIP; public class ValueRefreshController : MonoBehaviour { [SerializeField] TextMeshProUGUI text; [SerializeField] Slider slider; [SerializeField] ButtonManager button; [SerializeField] GlobalValueType globalValueType = GlobalValueType.MONEY; static string[] times = new string[4]{ "Morning", "Afternoon", "Evening", "Night" }; enum GlobalValueType { MONEY, STATUS, DAY, TIME, MOOD, HUNGER, AFFECTION, CANWORK }; // Start is called before the first frame update void Start() { } // Update is called once per frame void FixedUpdate() { switch(globalValueType) { case GlobalValueType.MONEY: text.SetText("$" + GameData.GLOBAL.money.ToString()); if (GameData.GLOBAL.money > 300) { text.color = Color.green; } else if (GameData.GLOBAL.money > 200) { text.color = Color.yellow; } else { text.color = Color.red; } break; case GlobalValueType.STATUS: text.SetText(GameData.GLOBAL.status.ToString()); if (GameData.GLOBAL.status == Status.Farty) { text.color = Color.yellow; } else if (GameData.GLOBAL.status == Status.Moody) { text.color = Color.red; } else { text.color = Color.green; } break; case GlobalValueType.DAY: text.SetText("Day " + GameData.GLOBAL.day.ToString()); break; case GlobalValueType.TIME: text.SetText(times[GameData.GLOBAL.time - 1]); break; case GlobalValueType.MOOD: slider.value = GameData.GLOBAL.mood; break; case GlobalValueType.HUNGER: slider.value = GameData.GLOBAL.hunger; break; case GlobalValueType.AFFECTION: text.SetText(GameData.GLOBAL.affection.ToString()); break; case GlobalValueType.CANWORK: button.isInteractable = !GameData.GLOBAL.workedToday; break; default: break; } } }