anedumgottil / VR-Mazmorra

Procedurally generated VR Dungeon
Apache License 2.0
1 stars 0 forks source link

MapGenerator needs a function to remove a GridSpace #21

Open apodgo2 opened 6 years ago

apodgo2 commented 6 years ago

Grid also needs a function to set a GridSpace to null, not just Destroy it and leave the skeleton (which, I think, it currently does? no time to check)

Right now we have a way to add tiles, but no way to remove them. We'd have to do it carefully, removing all of the attached gameobjects and destroying them, Tile by Tile, Block by Block, StationaryEntity by StationaryEntity.

apodgo2 commented 6 years ago

IMPORTANT COMPLICATION DETECTED!

This isn't extremely mandatory for getting the MapGenerator to work, but once we've got the map generated, the MapGenerator relies on null values in the Grid to determine if it doesn't need to update GridSpaces upon Grid modification. So if you want a GridSpace removed, you'll need to set it to null, then update the neighbors for the tile <----------- therein lies the problem

Updating the neighbors for the GridSpace is only currently defined to work during the addition of GridSpaces, if we start removing them we'll need a direction to recurse towards, which involves getting all the neighbors for the GridSpace we want to remove first, then determining which of those would be affected by this GridSpace removal, and applying the changes necessary which is the map generation algorithm in REVERSE.... which really hurts my head. which leads me to:

MAPGENERATOR should be used to remove GridSpaces from the Grid, if you want to update the neighborly tiles appropriately

but Grid should still be used to do the actual removal and destruction of GameObjects and such.

Updating title to reflect this.

apodgo2 commented 6 years ago

I added some code to the setBlock of GridSpace that Destroy()s the block gameobjects upon overwriting them, so a similar thing could be done with the entire block or gridobject in general

apodgo2 commented 6 years ago

removing milestone because I think we can demo this without that functionality, just spawning in blocks using the VR controller if necessary to show it off.