public MapLocation(int x, int y, Map map) : base(x, y) { if (!map.IsOnMap(this)) { throw new OutOfBoundsException($"{x}, {y} is outside the boundaries of the map!"); } }
public Tower(MapLocation location, Map map, Path path) { _map = map; _path = path; if (!map.IsOnMap(location)) { throw new OutOfBoundsException($"({location.X},{location.Y}) is not on the map!"); } else if (!path.IsOnPath(location)) { _location = location; } else { throw new OnPathException($"({location.X},{location.Y}) cannot be placed on the path!"); } }