OK, so literally wasted the past three days trying to figure out something that should be really simple - so please if someone can help, I’m begging you.
To start I’m using the code here as my basis:
http://pastebin.com/pkN8vNRz
http://pastebin.com/DvjRLQLV
And I’ve replaced the seeker.startpath with seeker.startmultitargetpath in the AIPathBase file.
I’ve got an agent that is calculating a multi target path to a destination. When he reaches the end of the path an effect is placed at the end point of the path. The agent then destroys the target and moves onto the next closest target. Sometimes the next closest target is really close, so close it just needs to turn around without any movement. So when I calculate that position for the effect it uses the old path since the new paths have yet to finish.
I’ve tried using the OnPathComplete but I see it fire multiple times and the end point of the path often still represents the old path for another second or so. I’ve tried using the path.WaitForPath() coroutine but I can’t find any good example code on how to set that up so whatever I’m trying is a disaster and gives me old values as well.
I’ve also tried using p.isDone() but that is always true if I use it in the onpathcomplete call back or false if I use it anywhere else.
I’ve also tried a whole bunch of other crazy shiz to tackle the problem indirectly but that hasn’t worked either.
So how can I get my agent to chill out until the calculation from multitargetpath is completed?