I am making a TD. It’s pretty standard. Build your own maze. I have the pathing running fine aside from one major issue.
I can easily and pretty much cost free check if a path from start to finish is being blocked. I just have to test a single path from start to finish each time a tower is placed. If it fails then don’ allow them to place it.
Is there any easy way to do this for creeps as well so you can’t block them in? Since it’s a TD there will end up being quite a bit of creeps so looping through each one would get costly fast.
The image below shows me carving a path from top down to the left, returns true until I block the path on the edge at which point it gives the error instead of returning false.
alright so I thought it was working correctly, but I am having an issue with it. It doesn’t seem to want to revert back unless it’s within a range from it. So the creeps just stay still (can’t reach their destination) until I place a tower near the blocked area.
First off in settings I do have
Min Area Size = 0
Max Update Frequency = 0
my code looks like this
This code is only called when a click is performed.
`
tower = GameObject.Instantiate(Resources.Load(“prefabs/tower”), position, Quaternion.identity) as GameObject;
GraphUpdateObject guo = new GraphUpdateObject(tower.collider.bounds);
List nodes = new List(AStarAI.creepOnNode.Values);