Beispiel #1
0
    public void ShowSkillMenu()
    {
        targetMenu.SetActive(false);
        skillMenu.SetActive(true);
        baseMenu.SetActive(false);
        currentMenu = MenuState.Skills;

        for (int i = 0; i < skillMenu.transform.childCount - 1; i++)
        {
            if (i >= actor.skills.Count)
            {
                targetMenu.transform.GetChild(i).gameObject.SetActive(false);
            }
            else
            {
                targetMenu.transform.GetChild(i).gameObject.SetActive(true);

                Action a = actor.skills[i];

                ActionButton button = targetMenu.transform.GetChild(i).GetComponent <ActionButton>();
                button.GetComponentInChildren <Text>().text = a.name;
                button.SetAction(a);
            }
        }
    }
Beispiel #2
0
    /// <summary>
    /// Update the actions shown on the buttons and their visibility.
    /// </summary>
    private void RefreshButtons()
    {
        // Populate buttons with actor's actions
        for (int i = 0; i < actionButtons.Length; i++)
        {
            ActionButton button = actionButtons[i];

            // Enable / Disable button
            bool enabled = i < ActionCount;
            button.gameObject.SetActive(enabled);

            if (enabled)
            {
                // Set the button's associated action.
                BattleAction action = ActionManager.Instance.SelectedActor.Actions[i];
                button.SetAction(action);
            }
        }
    }