// Generate a line from one coordinate to another
	// You can ask for it to be totaly walls or totally floor, based on the bool
	// False: Walls
	// True: Floor
	public static void makeLine(Tile[,] map, Coord begin, Coord end, bool applyFloor) {

		// Assert in range
		if( begin.isOOB (map.GetLength(0), map.GetLength (1), Direction.Stop) ||
		    end.isOOB (map.GetLength(0), map.GetLength (1), Direction.Stop) )
			return;
		
		int startX = begin.x;
		int endX = end.x;
		int startY = begin.y;
		int endY = end.y;


		// Find the linear spacing appropriate from point
		// including the endpoint
		int lengthX = Math.Abs( endX - startX );

		var linspace = new List<Double>();
			linspace = LinSpace (startY, endY, lengthX, true).ToList ();

		// Now it's time to actually put our money where our mouth is
		for(int i = startX; i < endX; i++) {
			int j = (int) linspace[i] ;
			map[i,j].property = applyFloor ? TileType.Floor1 : TileType.OuterWall1;
		}

		// Phew! Thought this one was so easy, didn't cha!?

		return;
	}
	// Generate a rectangle starting from the topleft point to the bottomright point
	// You can ask for it to be totally walls or totally floor, based on the bool
	// False: Walls
	// True: Floor
	public static void makeRectangle(Tile[,] map, Coord topLeft, Coord bottomRight, bool applyFloor) {

		// Assert that topLeft and bottomRight are in range
		if( topLeft.isOOB (map.GetLength(0), map.GetLength (1), Direction.Stop) ||
			bottomRight.isOOB (map.GetLength(0), map.GetLength (1), Direction.Stop) )
			return;

		int startX = topLeft.x;
		int endX = bottomRight.x;
		int startY = bottomRight.y;
		int endY = topLeft.y;

		for(int i = startX; i < endX; i++) {
			for(int j = startY; j < endY; j++) {
				map[i,j].property = applyFloor ? TileType.Floor1 : TileType.OuterWall1;
			}
		}

		return;

	}
	/**
	 *  isSolid is a boolean function that checks
	 *  if a tile is on top of a "wall" or is OOB.
	 */
	public bool isSolid(Tile[,] map, Coord target) {
		int rows = map.GetLength (0);
		int columns = map.GetLength (1);

		if(target.isOOB (rows,columns,Direction.Stop)) return true;

		//Debug.Log (map[target.x, target.y].property);


		return ( map[target.x, target.y].property == TileType.OuterWall1 );
	}