Beispiel #1
0
        /// <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);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Insert a skill turn during which a bunny uses a special skill.
        /// </summary>
        /// <param name="skillIndex">The index of the skill to use.</param>
        public void InsertBunnySkillTurn(int skillIndex)
        {
            Bunny user = SelectedBunny;

            // Make sure bunny can use the selected skill
            if (!user.CanUseSkill(skillIndex))
            {
                return;
            }

            // Create turn
            Turn turn;

            if (user.Skills[skillIndex].Target == Globals.FighterType.Bunny)
            {
                turn = new Turn(user, currentBunnies, string.Format(skillMessage, user.name, user.Skills[skillIndex].Name), () => user.UseSkill(skillIndex, currentBunnies));
            }
            else
            {
                turn = new Turn(user, GetAliveEnemies(), string.Format(skillMessage, user.name, user.Skills[skillIndex].Name), () => user.UseSkill(skillIndex, GetAliveEnemies()));
            }

            // Insert turn
            turnCollection.Insert(turn);

            // Move to next input
            NextInput();
        }