The state classes

Unlike in our previous SimpleFSM example, the states for our tank AI are written in separate classes inherited from the FSMState class, such as AttackState, ChaseState, DeadState, and PatrolState, each of which implements the Reason and Act methods. Let's take a look at the PatrolState class as an example.

Get Unity Artificial Intelligence Programming - Fourth 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.