private void OnPathComplete(Path newPath)
{
// We need to be careful and check the 'moving' variable here, since
// if we started calculating a path, and cancelled it quickly, we will still receive
// the OnPathComplete() event even tough the movement was cancelled.
// Note that the case where we start a new path, cancel it, and start a new one
// quickly works correctly, since in this case the Seeker will cancel the first path
if ((moving || running) && !newPath.error)
{
path = newPath;
currentWaypoint = 0;
}
}