//Contructs a tower. Throws exceptions for invalid ranges of values (18 lines)
public Tower(String name, int health, int damage, int cost, int range, Rectangle location)
{
if (location.Equals(new Rectangle()))
throw new ArgumentNullException();
if (range <= 0)
throw new ArgumentOutOfRangeException();
if (damage < 0)
throw new ArgumentOutOfRangeException();
if (health <= 0)
throw new ArgumentOutOfRangeException();
if (cost < 0)
throw new ArgumentOutOfRangeException();
this.name = name;
this.location = location;
this.health = health;
this.attackDamage = damage;
this.cost = cost;
this.range = range;
this.updateCounter = 0;
this.nearbyEnemies = new List<Enemy>();
this.color = Color.White;
switch (name)
{
case "path":
this.color = Color.Black;
break;
case "slow":
this.color = Color.Blue;
break;
case "dot":
this.color = Color.Red;
break;
case "sniper":
this.color = Color.Green;
break;
}
if (color == Color.White)
name = "basic";
}