private void bunkerHealing(Bunker bunker) { if (bunker.health != 0 && bunker.health != 3) { bunker.health++; } }
Bunker enemyBunkerToHeal() { Random rdn = new Random(); int bunkersChosen = 0; int bunkersAliveIterator = 0; Bunker temp = new Bunker(this, 0, 20, 20); bunkersChosen = rdn.Next(0, bunkersAliveCounter); foreach (var subcollection in bunkers[gameParams.level - 1]) { foreach (var bunker in subcollection) { if (bunkersAliveIterator == bunkersChosen) { temp = bunker; } if (bunker.health != 0) { bunkersAliveIterator++; } } } return(temp); }
void timerTick(object sender, EventArgs e) { ticPrescaler++; Tower tempTower = new Tower(this, 0); Bunker tempBunker = new Bunker(this, 0); if (ticPrescaler > ticPrescalerMax) { ticPrescaler = 0; if (gameParams.reload < barsLength) { if (gameParams.reload <= barsLength - ticMultiplier) { gameParams.reload += ticMultiplier; } else { gameParams.reload = barsLength; } } } if (bunkersAliveCounter != 0) { bunkerHealingIterator++; if (bunkerHealingIterator == bunkerHealingTime) { bunkerHealingIterator = 0; tempBunker = enemyBunkerToHeal(); bunkerHealing(tempBunker); } } if (towersAliveCounter != 0) { towerSalvoIterator++; if (towerSalvoIterator == towerSalvoTime) { towerSalvoIterator = 0; tempTower = enemyTowerToShoot(); towerSalvo(tempTower); } } playerShoot(); }