Пример #1
0
 void ActivateUnitInfoPanel(PartyUnit partyUnit, BackgroundIntermediate.Mode backgroundMode)
 {
     // activate intermediate background
     backgroundIntermediate.SetActive(true, backgroundMode);
     // activate it
     gameObject.SetActive(true);
     // Fill in unit name
     if (partyUnit.GivenName != partyUnit.UnitName)
     {
         transform.Find("UnitName").GetComponent <Text>().text = partyUnit.GivenName;
         // activate unit class, because unit has his own name
         transform.Find("NamedUnitClass").gameObject.SetActive(true);
         transform.Find("NamedUnitClass").GetComponent <Text>().text = partyUnit.UnitName;
     }
     else
     {
         transform.Find("UnitName").GetComponent <Text>().text = partyUnit.UnitName;
         // deactivate unit class, because it is the same as name
         transform.Find("NamedUnitClass").gameObject.SetActive(false);
     }
     // Fill in unit level
     transform.Find("Panel/UnitLevel/Value").GetComponent <Text>().text = partyUnit.UnitLevel.ToString();
     // Fill in unit current and experience required to reach next level
     transform.Find("Panel/UnitExperience/Value").GetComponent <Text>().text = partyUnit.UnitExperience.ToString() + "/" + partyUnit.UnitExperienceRequiredToReachNextLevel.ToString();
     // Verify if unit is leader
     if (partyUnit.IsLeader)
     {
         // unit is leader
         // Fill in leadership information
         SetUnitLeadershipInfo(partyUnit);
         // Set unit move points info
         SetUnitMovePointsInfo(partyUnit);
         // Set scouting range info
         SetUnitScoutingRangeInfo(partyUnit);
     }
     else
     {
         // unit is common unit
         // deactivate leadership info
         transform.Find("Panel/LeaderAttributes").gameObject.SetActive(false);
     }
     // Fill in unit health current and max
     SetUnitHealthInfo(partyUnit);
     // Fill in unit effective defense including additional defense mondifiers:
     SetUnitDefenseInfo(partyUnit);
     // Fill in resistances
     SetUnitResistancesInfo(partyUnit);
     // Fill in immunities
     // .. - replaced with resistance 100% = immune
     //string immunities = "";
     //// verify if there are any rezistances
     //if (partyUnit.GetImmunities().Length > 0)
     //{
     //    for (int i = 0; i < partyUnit.GetImmunities().Length; i++)
     //    {
     //        //  UnitPowerSource resistance in partyUnit.GetResistances())
     //        // if this is first resistance then do not add "/" at the end
     //        if (0 == i)
     //        {
     //            immunities = partyUnit.GetImmunities()[i].ToString();
     //        }
     //        else
     //        {
     //            immunities = immunities + ", " + partyUnit.GetImmunities()[i].ToString();
     //        }
     //    }
     //}
     //transform.Find("Panel/UnitImmunities/Value").GetComponent<Text>().text = immunities;
     // Fill in unit initiative
     SetUnitInitiativeInfo(partyUnit);
     // Fill in unit ability
     transform.Find("Panel/UnitAbility/Name").GetComponent <Text>().text = partyUnit.UnitAbilityID.ToString();
     // Fill in unit power
     SetUnitPowerInfo(partyUnit);
     // Fill in unit power source
     transform.Find("Panel/AbilityParameters/Source").GetComponent <Text>().text = partyUnit.UnitAbilityPowerSource.ToString();
     // Fill in unit distance
     transform.Find("Panel/AbilityParameters/Distance").GetComponent <Text>().text = partyUnit.UnitAbilityRange.ToString();
     // Fill in unit power scope
     transform.Find("Panel/AbilityParameters/Scope").GetComponent <Text>().text = partyUnit.UnitAbilityPowerScope.DisplayName;
     // Fill in information about unique power modifiers
     FillInUniquePowerModifiersInformation(partyUnit);
     // Fill in description
     transform.Find("Panel/UnitDescription/Value").GetComponent <Text>().text = partyUnit.UnitFullDescription.ToString();
 }
Пример #2
0
 public void ActivateAdvance(PartyUnit partyUnit, Align align = Align.Middle, bool isInterractible = true, ContentMode mode = ContentMode.Full, BackgroundIntermediate.Mode backgroundMode = BackgroundIntermediate.Mode.MiddleScreen)
 {
     // verify party unit is not null, if it is null,
     // then user right clicked on a cell without unit
     if (partyUnit)
     {
         ActivateUnitInfoPanel(partyUnit, backgroundMode);
         SetAlign(align);
         interactable = isInterractible;
         if (mode == ContentMode.Full)
         {
             // activate full mode Br
             transform.Find("BrFull").gameObject.SetActive(true);
             // deactivate short mode Br
             transform.Find("BrShort").gameObject.SetActive(false);
             // activate unit description
             transform.Find("Panel/UnitDescription").gameObject.SetActive(true);
         }
         else if (mode == ContentMode.Short)
         {
             // deactivate full mode Br
             transform.Find("BrFull").gameObject.SetActive(false);
             // activate short mode Br
             transform.Find("BrShort").gameObject.SetActive(true);
             // deactivate unit description
             transform.Find("Panel/UnitDescription").gameObject.SetActive(false);
         }
         else
         {
             Debug.LogError("Unknown mode: " + mode.ToString());
         }
     }
 }