public void UpdateUI(HumanType humanType) { AnimalButton btn = this.animalButtons.FirstOrDefault(x => x.HumanType == humanType); if (btn != null) { btn.UpdateUI(); } }
public void Init() { foreach (AnimalType animal in Enum.GetValues(typeof(AnimalType))) { GameObject obj = GameObject.Instantiate(this.AnimalButtonTemplate, this.transform); AnimalButton btn = obj.GetComponent <AnimalButton>(); btn.AnimalType = animal; btn.AnimalIconImage.sprite = ModHandler.mods.sprites[$"animalButtonIcon_{animal}"]; btn.UpdateUI(); animalButtons.Add(btn); } }