Ejemplo n.º 1
0
    private void Inventory_OnEquipmentChanged(EquipmentStack obj)
    {
        var    w   = Others.GetWeightByMass(squad.UnitStats.EquipmentMass);
        Sprite ico = null;
        int    cnt = 0;

        if (w == UnitStats.EquipmentWeight.VERY_LIGHT)
        {
            ico = lightWeight;
            cnt = 1;
        }
        else if (w == UnitStats.EquipmentWeight.VERY_HEAVY)
        {
            ico = heavyWeight;
            cnt = 3;
        }
        else
        {
            ico = mediumWeight;
            if (w == UnitStats.EquipmentWeight.HEAVY)
            {
                cnt = 3;
            }
            else if (w == UnitStats.EquipmentWeight.MEDIUM)
            {
                cnt = 2;
            }
            else
            {
                cnt = 1;
            }
        }

        for (int i = 0; i < 3; i++)
        {
            if (i < cnt)
            {
                var img = weightIcons[i].sprite = ico;
                weightIcons[i].gameObject.SetActive(true);
            }
            else
            {
                weightIcons[i].gameObject.SetActive(false);
            }
        }

        var ind = weightIcons[0].transform.parent.GetComponent <SquadPropertyIndicator>();
        var d   = new Description();

        d.Name = w.GetNameLocalize();
        d.Desc = LocalizedStrings.weight_description;
        ind.Present(null, d);

        Squad_OnModifiersListChanged(squad.StatsModifiers);
        Squad_OnTerrainModifiersListChanged(squad.TerrainStatsModifiers);
    }
Ejemplo n.º 2
0
 void Present()
 {
     if (squad != null && gameObject.activeInHierarchy && Active)
     {
         var    w   = Others.GetWeightByMass(squad.UnitStats.EquipmentMass);
         Sprite ico = null;
         int    cnt = 0;
         if (w == UnitStats.EquipmentWeight.VERY_LIGHT)
         {
             ico = lihgtWeight;
             cnt = 1;
         }
         else if (w == UnitStats.EquipmentWeight.VERY_HEAVY)
         {
             ico = heavyWeight;
             cnt = 3;
         }
         else
         {
             ico = mediumWeight;
             if (w == UnitStats.EquipmentWeight.HEAVY)
             {
                 cnt = 3;
             }
             else if (w == UnitStats.EquipmentWeight.MEDIUM)
             {
                 cnt = 2;
             }
             else
             {
                 cnt = 1;
             }
         }
         for (int i = 0; i < weightIcons.Length; i++)
         {
             if (i < cnt)
             {
                 weightIcons[i].sprite = ico;
                 weightIcons[i].gameObject.SetActive(true);
             }
             else
             {
                 weightIcons[i].gameObject.SetActive(false);
             }
         }
     }
 }
Ejemplo n.º 3
0
 public UnitStatsModifier GetModifierByEquipmentMass(float equipmentMass)
 {
     return(GetModifierByEquipmentMass(Others.GetWeightByMass(equipmentMass)));
 }