How to make a drilling mechanic?

I have a 2D side view in my game and I want to make a drilling/digging mechanic.

I made a terrain with Super Tilemap Editor Unity Asset Store - The Best Assets for Game Making

The terrain is completely flat with grass on top and dirt under it with different resources.

Now I want a building on top that digs down vertically every X minutes. Basically, it will replace the tiles with a “background tile” that can be traversed with pathfinding. Other tiles block movement.

So in the end there will be a vertical shaft.

How would I go about doing this?

Hi Zymes,

You can ask in the forum thread http://forum.unity3d.com/threads/soon-super-tilemap-editor.387330/
I almost miss this question. Sometimes I search for “Super Tilemap Editor” and found your thread.
You can change a tile simply by calling the method SetTileData with a grid position or a local position.

For example, if you have the drill position, like drill.transfom.position, you can drill the tile bellow like this:

tilemap.SetTileData(drill.transform.position + Vector2.down * tilemap.CellSize.y, newTileId);

This will change the tile at a position below the drill position at a distance of the cell height. You may need to adjust this a little depending on the drill pivot in the sprite.

You can also change a tile with a grid position.
If you don’t know the grill grid position, you can use the TilemapUtils class:

int gridX = TilemapUtils.GetGridX(tilemap, grill.transform.position);
int gridY = TilemapUtils.GetGridY(tilemap, grill.transform.position);
tilemap.SetTileData(gridX, gridY + 1, newTileId);

For pathfinding, you can check the Roguelike demo scene. There is an example with a gameObject moving to the clicked position. If you have questions let me know.

Also, you can find more information here:
https://creativespore.com/category/tutorialsupertilemapeditor/

Thanks I will try that.