Let's review the A* algorithm again, before we proceed to implement it in the next section. The foundation of any pathfinding algorithm is a representation of the world. Pathfinding algorithms cannot search over the noisy structure of polygons in the game map; instead, we need to provide them with a simplified version of the world in which we identify the locations that can be traversed by the agent, and the ones that are inaccessible.
There are many ways of doing this; however, for this example, we will use one of the most straightforward solutions: a 2D grid. Therefore, we will implement the GridManager class in order to convert the real map into a 2D tile representation. The GridManager class keeps a list of Node objects, representing a single tile in the 2D grid. Of course, we need to implement the Node class too: this class stores node information...