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 ...