Task 1 – Currying tower attack functions
Refactor the AttackEnemy
function using currying, allowing the towerType
to be preset for multiple uses throughout the game while accepting dynamic inputs for enemyId
and damage
:
public void AttackEnemy(TowerTypes towerType, int enemyId, int damage) { Console.WriteLine($"Tower {towerType} attacks enemy {enemyId} for {damage} damage."); }