How it works...

The FormationPattern class contains the relative positions for a given slot. For example, a CircleFormation child class will implement the GetSlotLocation class, given the number of slots and its locations over 360 degrees. It is intended to be a basic class, so it is up to the manager to add a layer for permissions and rearrangement. That way, the designer can focus on simple formation scripting, deriving from the base class.

The FormationManager class, as stated earlier, handles the high-level layer and arranges the locations as it better fits the formation's needs and permissions. The calculations are based on top of the leader's position and rotation, and they apply the necessary transformations given the pattern's principles. ...

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.