Open apodgo2 opened 7 years ago
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:
but Grid should still be used to do the actual removal and destruction of GameObjects and such.
Updating title to reflect this.
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
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.
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.