There's more...

It is worth mentioning that the SensoryManager class works as a hub to store and organize the list of agents and the list of interest sources, so it ought to be a singleton. Its duplication could bring about undesired complexity or behavior.

An agent's interest is automatically changed by the sensory manager using the priority values. Still, it can be reset when needed, using the Notice public function.

There is room for improvement still, depending on our game. The scout lists can overlap each other, and it's up to us and our game to handle this scenario the best way we can. However, the system we built takes advantage of the priority values to make decisions.

Get Unity 2018 Artificial Intelligence Cookbook - Second 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.