Example #1
0
    public void OnUserSelected(int pos)
    {
        CharStats selectedUser = GameManager.Instance.GetCharacterAt(pos);

        ItemManager.Instance.UseItem(display.CurrentPossessor, display.SelectedPos, selectedUser);
        display.DisplayAll();

        // Decrease number of remaining items
        numOfRemaining--;

        // If there aren't any remaining items
        if (numOfRemaining == 0)
        {
            Cancel();
            gameObject.SetActive(false);
            return;
        }

        // Else
        UpdateRemaining();

        if (isHPMP)
        {
            HPMP temp = GetHPMP(changingAttr, selectedUser);
            userButtons[pos].DisplayStat(temp.current, temp.max);
        }
        else
        {
            userButtons[pos].DisplayStat(GetStat(changingAttr, selectedUser));
        }
    }
Example #2
0
    private void DisplayParty()
    {
        CharStats[] party = GameManager.Instance.GetActiveChars();

        Item selectedItem = ItemManager.Instance.GetItemAt(display.SelectedPos, display.CurrentPossessor);

        // Set number of items remaining
        numOfRemaining = ItemManager.Instance.GetNumOfItemsAt(display.SelectedPos, display.CurrentPossessor);
        UpdateRemaining();

        // Set character's stat to be changed
        changingAttr = selectedItem.Effects[0].Attribute;

        if (changingAttr == EntityStats.Attributes.HP ||
            changingAttr == EntityStats.Attributes.MAX_HP ||
            changingAttr == EntityStats.Attributes.MP ||
            changingAttr == EntityStats.Attributes.MAX_MP)
        {
            isHPMP = true;

            for (int i = 0; i < party.Length; i++)
            {
                HPMP temp = GetHPMP(changingAttr, party[i]);
                userButtons[i].InitDisplay(party[i].CharacterName, temp.current, temp.max, changingAttr);
            }
        }
        else
        {
            isHPMP = false;

            for (int i = 0; i < party.Length; i++)
            {
                userButtons[i].InitDisplay(party[i].CharacterName, GetStat(changingAttr, party[i]), changingAttr);
            }
        }
    }