Unity 2017 Game AI Programming - Third Edition - Third Edition
by Raymundo Barrera, Aung Sithu Kyaw, Thet Naing Oo
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access