Game Development Reference
this.animation["run"].wrapMode = WrapMode.Loop;
function Start ()
//draw the paths in the scene view of the editor while playing
//if there is no path or at the end don't do anything
if(graph.getPathLength()==0 || currentWP == graph.
//if we are close enough to the current waypoint move to next
transform.position) < accuracy)
//if we are not at the end of the path
if(currentWP < graph.getPathLength())
//keep on movin'
var direction =
rotationSpeed * Time.deltaTime);
transform.Translate(0, 0, Time.deltaTime
Step 8. Play. When the Patrol button is pressed the A* algorithm will
calculate a path between the first and last waypoint and the guard
will start running around it.