Hi, I’m currently developing a dungeon-crawler game where there are multiple enemies in each room that try to get to the player to attack him. There are some rooms where the enemies are trapped and cannot move until freed.
I need an efficient way to check if the enemy can ever reach the player.
I tried with PathUtilities.IsPathPossible, however it seemed kind of redundant since the enemy itself would also calculate another path by itself.
I looked into AIPath.GetRemainingPath, but it seems expensive on resources since it copies all elements of the node list each time it’s called, so I don’t want to use it in the Update method for each enemy.
Looking through that very method though, I realized that I only needed the last point of the path to check if it could reach the player. PathInterpolator has the endPoint property which seems like the perfect solution, however it’s not exposed through AIPath.
I don’t really want to rewrite my enemy script to extend AIPath since this is the only “advanced feature” I need.
For now, I just added a method to AIPath that exposes the interpolator property, but it certainly isn’t the way to go, and it wouldn’t survive a package update.
Could this be implemented in a future update? Or I need to write my own AIPath anyway?