public void TowersAction() { for (int i = 0; i < GameUtils.PLAYER_COUNT; i++) { ITowerIterator iterator = _game.players[i].Towers.CreateIterator(); for (EnemyAttacker tower = iterator.First(); !iterator.IsDone; tower = iterator.Next()) { tower.TowerAction.Action(tower, _game.players[i]); } } }
private EnemyAttacker GetTower(Player player, int towerId) { ITowerIterator iterator = player.Towers.CreateIterator(); for (EnemyAttacker tower = iterator.First(); !iterator.IsDone; tower = iterator.Next()) { if (tower.Id == towerId) { return(tower); } } return(null); }