Ejemplo n.º 1
0
 private void AddUpgradeToList(DwellingUpgrade upgrade)
 {
     for (int i = 0; i < activeUnitUpgrades.Length; i++)
     {
         if (activeUnitUpgrades[i] == null)
         {
             activeUnitUpgrades[i] = upgrade;
         }
     }
 }
Ejemplo n.º 2
0
 private bool CheckIfUpgradeExists(DwellingUpgrade upgrade, UpgradeType upgradeType, out int index) // Returns true if upgrade exists
 {
     for (int i = 0; i < activeUnitUpgrades.Length; i++)
     {
         if (activeUnitUpgrades[i] != null && activeUnitUpgrades[i].GetUpgradeType() == upgradeType)
         {
             index = i;
             return(true);
         }
     }
     index = 0;
     return(false);
 }
Ejemplo n.º 3
0
 public void AddUpgrade(DwellingUpgrade upgrade)
 {
     if (upgrade.GetUpgradeType() == UpgradeType.Damage)
     {
         int index;
         if (CheckIfUpgradeExists(upgrade, UpgradeType.Damage, out index))
         {
             activeUnitUpgrades[index].IncrementLevel();
             return;
         }
     }
     else if (upgrade.GetUpgradeType() == UpgradeType.SpawnExtraUnits)
     {
         SetNumberOfUnitsToSpawnPerCountdown(GetNumberOfUnitsSpawnedPerCountdown() + Mathf.RoundToInt(upgrade.GetUpgradeVariables()[upgrade.GetCurrentLevel()]));
     }
 }