public float GetTotalLength () {
if (vectorPath == null) return float.PositiveInfinity;
float tot = 0;
for (int i=0;i<vectorPath.Count-1;i++) tot += Vector3.Distance (vectorPath[i],vectorPath[i+1]);
return tot;
}
public void OnPathComplete(Path p) { if(p.error) { length = -1.0f; } else { length = p.GetTotalLength(); startSearch(); } }