Driving parameters via code

Before going any further, we'll need a few things from the assets we imported earlier in the chapter. For starters, go ahead and open the DemoScene for this chapter. You'll notice the scene is fairly stripped down and only contains an environment prefab and some waypoint transforms. Go ahead and drop the EnemyTankPlaceholder prefab into the scene.

You may notice a few components that you may or may not be familiar with on the EnemyTank. We'll get a chance to thoroughly explore NavMesh and NavMeshAgent in Chapter 4, Finding Your Way, but for now, these are necessary components to make the whole thing work. What you will want to focus on is the Animator component which will house the state machine (animator controller) ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.