Implementing a TestCode class

Now that we have the A* algorithm implemented via our AStar class (and the associated helper classes), we actually implement it using the TestCode class. The TestCode.cs file looks like this:

using UnityEngine;using System.Collections;public class TestCode : MonoBehaviour {    private Transform startPosition;    private Transform endPosition;    public Node startNode { get; set; }    public Node goalNode { get; set; }    private ArrayList pathArray;    private GameObject startCube;    private GameObject endCube;      private float elapsedTime = 0.0f;    public float intervalTime = 1.0f;     private GridManager gridManager;

We declare our variables here, and once again set up a variable to hold a reference to our GridManager. Then, the Start ...

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.