static int Reset(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Pathfinding.Path obj = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1); obj.Reset(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public float CalculateDistance(Vector2 a, Vector2 b) { path = seeker.StartPath (a, b); List<Vector3> vPath = path.vectorPath; float totalDistance = 0; Vector2 current = a; //Iterate through vPath and find the distance between the nodes for (int i = 0; i < vPath.Count; i++) { totalDistance += ((Vector2)vPath[i] - current).magnitude; current = vPath[i]; } totalDistance += (b - current).magnitude; path.Reset() ; return totalDistance; }