Esempio n. 1
0
 private void BuildUnits()
 {
     // if i am building miners before units and I can have 3 miners
     if (myGoldNodes >= 2 && buildMinerBeforeUnits == true && maxMinerCount == 3 && enemyBattleManagerScript.myEnemyMiners.Count < 3)
     {
         // if i have enough resources to build my miner
         if (enemyBattleManagerScript.enemyResourcesAmount[0] >= mySpawnableUnits[0].GetComponent <UnitStats>().unitCost)
         {
             // build him
             enemyBattleManagerScript.SpawnEnemyUnit(mySpawnableUnits[0]);
         }
     }
     // if I am not building miners fist then build a unit if I have less than my max
     // Arius can only spawn a settler unit
     else if (enemyBattleManagerScript.mySpawnedUnits.Count < maxUnitCount)
     {
         if (enemyBattleManagerScript.enemyResourcesAmount[0] >= mySpawnableUnits[1].GetComponent <UnitStats>().unitCost)
         {
             enemyBattleManagerScript.SpawnEnemyUnit(mySpawnableUnits[1]);
         }
     }
     // if im at max units then build a miner if I can
     else if (enemyBattleManagerScript.mySpawnedUnits.Count >= maxUnitCount)
     {
         // if I can build the miner
         if (enemyBattleManagerScript.myEnemyMiners.Count <= 2 && maxMinerCount == 3)
         {
             // and I have the resources
             if (enemyBattleManagerScript.enemyResourcesAmount[0] >= mySpawnableUnits[0].GetComponent <UnitStats>().unitCost)
             {
                 enemyBattleManagerScript.SpawnEnemyUnit(mySpawnableUnits[0]);
             }
         }
     }
 }