10

AI Manager

The AI controller in this book is a state machine. You may have heard of this before, but do we mean when we say state machine? Our AI system stores the current state of the AI and runs code according to whichever state it is. When the state changes, it runs different code. For example, when our state is set to chase, the AI should move toward an object. When the state is set to stopped, the AI should stand still. This is state machine AI.

In this book, the AI is split into several different scripts that fit together to add functionality. You can think of our main AI class, BaseAIController, as a class containing a set of utility functions for AI rather than a single all-encompassing script.

  1. BaseAIControllerThis contains ...

Get C# Game Programming Cookbook for Unity 3D, 2nd 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.