/// <summary> /// Funkcja odpowiedzialna za atak drugiej armii /// </summary> /// <param name="enemyArmy"></param> /// <param name="random"></param> public void Attack(Army enemyArmy, Random random) { if (InfantryList.Any()) { foreach (Infantry infantry in InfantryList) { infantry.Attack(enemyArmy, random); enemyArmy.Sort(); } } if (TankList.Any()) { foreach (Tank tank in TankList) { tank.Attack(enemyArmy, random); enemyArmy.Sort(); } } if (PlaneList.Any()) { foreach (Plane plane in PlaneList) { plane.Attack(enemyArmy, random); enemyArmy.Sort(); } } }
/// <summary> /// Funkcja sortujaca wszystkie listy /// </summary> public void Sort() { InfantryList.Sort(new UnitListComparer()); TankList.Sort(new UnitListComparer()); PlaneList.Sort(new UnitListComparer()); }