예제 #1
0
    public void SetUnitPowerInfo(PartyUnit partyUnit)
    {
        // Get power text
        Text powerText = transform.Find("Panel/AbilityParameters/Power").GetComponent <Text>();
        // Get party unit effective power value
        int effectivePower = partyUnit.GetUnitEffectivePower();

        // Display effective power absolute value
        powerText.text = Math.Abs(effectivePower).ToString();
        // get base power value
        int basePower = partyUnit.UnitAbilityEffectivePower - GetStatsPowerBonus(partyUnit);

        // verify if effective power does not equal to base power
        if (effectivePower != basePower)
        {
            // Display additional modifiers between brackets
            powerText.text += "(";
            // set default unit power without bonuses (without just upgraded stats power bonus)
            powerText.text += baseStatPreviewStyleStart + Math.Abs(basePower).ToString() + baseStatPreviewStyleEnd;
            // get and add stats power bonus if it is present
            AddBonusInfoToText(powerText, Math.Abs(GetStatsPowerBonus(partyUnit)), statsBonusPreviewStyleStart, statsBonusPreviewStyleEnd);
            // get and add offence skill bonus to text
            AddBonusInfoToText(powerText, Math.Abs(partyUnit.GetOffenceSkillPowerBonus()), skillBonusPreviewStyleStart, skillBonusPreviewStyleEnd);
            // get and add items bonus to the text
            AddBonusInfoToText(powerText, Math.Abs(partyUnit.GetItemsPowerBonus()), itemBonusPreviewStyleStart, itemBonusPreviewStyleEnd);
            // close brackets
            powerText.text += ")";
        }
    }