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); }
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); } } } }
public UnitStatsModifier GetModifierByEquipmentMass(float equipmentMass) { return(GetModifierByEquipmentMass(Others.GetWeightByMass(equipmentMass))); }