Setting up our grid manager

The GridManager class does a lot of the heavy lifting in terms of arranging and visualizing our grid. Compared to some of the code we've seen so far in this book, it's a fairly lengthy class, since it provides several helper methods. Pop open the GridManager.cs class to follow along:

 [SerializeField] private int numberOfRows = 20; [SerializeField] public int numberOfColumns = 20; [SerializeField] public float gridCellSize = 2; [SerializeField] public bool showGrid = true; [SerializeField] public bool showObstacleBlocks = true; private Vector3 origin = new Vector3(); private GameObject[] obstacleList; private Node[,] nodes { get; set; } 

We start off by setting up some variables. We specify how many rows and columns ...

Get Unity 2017 Game AI Programming - Third 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.