/// <summary> /// Set the number of active skill buttons and the text on each button. /// </summary> /// <param name="bunny">The bunny to set skill buttons for.</param> private void SetSkillButtons(Bunny bunny) { string[] availableSkills = bunny.GetAvailableSkillStrings(); for (int i = 0; i < skillButtons.Length; i++) { Button button = skillButtons[i]; if (i < availableSkills.Length) { // Activate button button.GetComponentInChildren <TMP_Text>().text = availableSkills[i]; if (!button.gameObject.activeSelf) { skillButtons[i].gameObject.SetActive(true); } button.interactable = bunny.CanUseSkill(i); } else if (button.gameObject.activeSelf) { // Hide button skillButtons[i].gameObject.SetActive(false); } } }
/// <summary> /// Set and display the options for a specific bunny. /// </summary> /// <param name="bunny">The bunny to set options for.</param> public void SetOptions(Bunny bunny) { bunnyName = bunny.name; DisplayOptionPrompt(); // Set skills if (bunny.GetAvailableSkillStrings().Length == 0) { skillOptionButton.SetActive(false); } else { skillOptionButton.SetActive(true); SetSkillButtons(bunny); } }