public void CountingEquipmentBonus() { int HealthPoints = 0; int DamagePoints = 0; float MovementBaseSpeed = 0f; float AttackSpeed = 0f; float CriticalDamageChance = 0f; int countItemsWithoutHotBar = CellContainer.transform.childCount + EquipmentContainer.transform.childCount; for (int i = CellContainer.transform.childCount; i < countItemsWithoutHotBar; i++) { HealthPoints += items[i].HP * items[i].Rarity; DamagePoints += items[i].DP * items[i].Rarity; MovementBaseSpeed += items[i].MBS * items[i].Rarity; AttackSpeed += items[i].AS * items[i].Rarity; CriticalDamageChance += items[i].CDC * items[i].Rarity; } //проверяем и считаем выбранный предмет string selecteditemType = GetTypeOfSelectedItem(); if (selecteditemType == "MeleeWeapon" || selecteditemType == "ShootWapon") { HealthPoints += items[SelectedItemIndex].HP * items[SelectedItemIndex].Rarity; DamagePoints += items[SelectedItemIndex].DP * items[SelectedItemIndex].Rarity; MovementBaseSpeed += items[SelectedItemIndex].MBS * items[SelectedItemIndex].Rarity; AttackSpeed += items[SelectedItemIndex].AS * items[SelectedItemIndex].Rarity; CriticalDamageChance += items[SelectedItemIndex].CDC * items[SelectedItemIndex].Rarity; } playerProperties.CountStats(HealthPoints, DamagePoints, MovementBaseSpeed, AttackSpeed, CriticalDamageChance); }