What would be the best way to do this?

What I want is my enemy AI to move from waypoint to waypoint and go around objects not through them. Also I want the enemy to stop at each waypoint and wait there for x amount of seconds then move on to the next. I also want other waypoints that are not part of the patrol but the enemy moves to when I do something. For example, if the enemy is in one room and I push a button, he will go to another room for x amount of time then go back to his patrol.
I don’t know how i should go about coding this. I was told to do a coroutine to pause the script so the enemy could wait but then would i not be able to have him go into his idle animation? Please help!

I understand fully that its alot. Thank you for the help! Ive tried to do this on my own and my script is just failing left and right.

Behaviour Tree is a nice tool for writing complex AI. Once you can the hang of it, it will be easier to define AI than using couroutines and plain C#.

Have a look at Panda BT (www.pandabehaviour.com). It’s a scripting framework based on Behaviour tree. The package contains several examples including patrol-chase-attack behaviours, which is close to what you want to do.

If you have any question about using this package or about Behaviour Tree in general, you are welcome on this forum thread.