예제 #1
0
    void SetUnitLeadershipInfo(PartyUnit partyUnit)
    {
        transform.Find("Panel/LeaderAttributes").gameObject.SetActive(true);
        // get attribute text
        Text attributeText = transform.Find("Panel/LeaderAttributes/Values/Leadership").GetComponent <Text>();

        // set current and max leadership
        attributeText.text = GetLeadershipConsumedByPartyUnitsExcludingLeader(partyUnit).ToString() + "/" + partyUnit.GetEffectiveLeadership().ToString();
        // verify if base leadership does not equal to effective leadership
        if (partyUnit.GetEffectiveLeadership() != partyUnit.UnitLeadership)
        {
            // Display how leadership is calculated
            attributeText.text += "(";
            // set default unit power without bonuses (without just upgraded stats power bonus)
            attributeText.text += baseStatPreviewStyleStart + partyUnit.UnitLeadership.ToString() + baseStatPreviewStyleEnd;
            // get and add skill bonus to text if upgrade unit panel is active
            AddBonusInfoToText(attributeText, partyUnit.GetLeadershipSkillBonus(), skillBonusPreviewStyleStart, skillBonusPreviewStyleEnd);
            // get and add items bonus to text if upgrade unit panel is active
            AddBonusInfoToText(attributeText, partyUnit.GetLeadershipItemsBonus(), itemBonusPreviewStyleStart, itemBonusPreviewStyleEnd);
            // close brackets
            attributeText.text += ")";
        }
    }