Making the cogs turn

This is the part I'm sure you've been waiting for. I know, I've kept you waiting, but for good reason. As we now get ready to dive into the coding, we do so with a good understanding of the logical connection between the states in our FSM. Without further ado, select our Patrol state. In the hierarchy, you'll see a button labeled Add Behaviour. Clicking this gives you a context menu very similar to the Add Component button on regular game objects, but as we mentioned before, this button creates the oh-so-unique state machine behaviors.

Go ahead and name this behavior TankPatrolState. Doing so creates a script of the same name in your project and attaches it to the state we created it from. You can open this script via ...

Get Unity 2017 Game AI Programming - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.