My pathfinder uses several tilemaps to create a hashset of occupied tiles, basically if a tile is occupied in any of those tilemaps, its position will be added to this list, this is because some tiles require to be above others.
however, some tiles are "obstacles", this is not a concept that exists within the code but a term used to describe them, basically lava tiles, spiks, etc.
when placing down nodes for the path finder (seeing if we have ground below, and if we fit etc) i want to avoid doing the checks for these obstacle tiles and move onto the next tile completely, meaning we do not place a node there, so enemies cant consider lava or spikes as a walkable node.
due to the earlier description of several tilemaps, and the fact that these tiles also have the "ground" layer because we want them to also be apart of logic that runs for ground (like touching them gives the player an extra jump etc).
the issue becomes now how do we cleanly seperate them?
i had two solution in mind:
#1
make an SO that holds list of tiles that are obstacles and let the CustomPathManager (the script that there will be an instance of in every scene and is the one that generates nav graphs through placing nodes and making connections and such) have a public field to insert this SO in, and when its iterating check if the tile we are at is contained in this list of obstacles
#2
make an interface with values with necessary fields such as "bool isObstacle" and we do a simple check like:
foreach tile in combined tiles
if tile is IExtraTileData && data.isObstacle
continue;
this however would require us to create a class for each tile type (Tile, RuleTile, AnimatedTile, etc) that we would want to use just to make it inherit from the interface, which is not bad, not that big of an issue to transfer into projects that include their own custom scripts for tiles cuz they too can js inherit from the interface.
i still wonder if there is a less messy way to implement this? or any advice