How it works...

The algorithm makes use of its private functions in order to adapt itself to the general functions derived from the parent's class, and it relies on simple mathematical functions to convert a two-dimensional vector position to a one-dimensional vector, or vertex index.

The LoadMap function needs to be implemented by you using your own map files, but, in the next section, we'll learn a way of implementing and reading certain kinds of text files containing maps based on grids. This will give you an idea of how to handle your files, and even use the same format for the commodity.

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.