I have a standard grid setup, agents are spawned in walking down a lane, the user places down towers that obstructs the grid making the agents move around the tower, like a maze building game.
I am trying to implement that a user can only place down a tower if that tower doesn’t obstruct the agents ability to create a path to the end. A collider is spawned before the tower that obstructs the grid, then the tower is placed upon the collider.
What I tried:
User tries to place tower, colliders are spawned obstructing the graph, I have a GameObject as an agent that’s immobile(like a path checker), I tell it to calculate path, I check if that gameobject has a path, then it can place tower, if not, warn the player.
This doesn’t work, it just places the towers, I am not sure I am using the function correctly, do you have any tips and ideas on how to solve this problem, I’m thinking there should be quite an easy solution to this…
I would love to hear your ideas, and I’m sorry if this is a question that I should’ve been able to solve myself!