void CreateRect(Vector2 startPos, int height, int width, Placement place) { transform.position = startPos; Direction4D moveSide = Direction4D.Right; Direction4D moveUpDown = Direction4D.Up; if (height == 0) { height = 1; } if (width == 0) { width = 1; } if (height < 0) { height = Mathf.Abs(height); moveUpDown = Direction4D.Down; } if (width < 0) { width = Mathf.Abs(width); moveSide = Direction4D.Left; } for (int i = 1; i <= height; i++) { for (int j = 1; j <= width; j++) { if (i == 1 || j == 1 || i == height || j == width) { place.CreateTile(transform.position, FloorType.outside); } else { place.CreateTile(transform.position, FloorType.inside); } if (j != width) { MoveGenerator(moveSide); } } if (i != height) { MoveGenerator(moveUpDown); transform.position = new Vector2(startPos.x, transform.position.y); } } }