static int DebugString(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Pathfinding.Path obj = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1); PathLog arg0 = (PathLog)ToLua.CheckObject(L, 2, typeof(PathLog)); string o = obj.DebugString(arg0); LuaDLL.lua_pushstring(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/** Prints path results to the log. What it prints can be controled using #logPathResults. * \see #logPathResults * \see PathLog * \see Pathfinding.Path.DebugString */ private void LogPathResults (Path p) { if (logPathResults == PathLog.None || (logPathResults == PathLog.OnlyErrors && !p.error)) { return; } string debug = p.DebugString (logPathResults); if (logPathResults == PathLog.InGame) { inGameDebugPath = debug; } else { //Debug.Log (debug); } }
/** Prints path results to the log. What it prints can be controled using #logPathResults. * \see #logPathResults \n PathLog * \todo Use string builder instead for lower memory footprint */ public void LogPathResults (Path p) { //string debug = ""; if (logPathResults == PathLog.None || (logPathResults == PathLog.OnlyErrors && !p.error)) { return; } string debug = p.DebugString (logPathResults); if (logPathResults == PathLog.InGame) { inGameDebugPath = debug; } else { Debug.Log (debug); } //Add stuff to the log /*if (active.logPathResults == PathLog.Normal || logPathResults == PathLog.OnlyErrors) { if (p.error) { debug = "Path Failed : Computation Time: "+(p.duration).ToString ("0.00")+" ms Searched Nodes "+p.searchedNodes+"\nPath number: "+PathsCompleted+"\nError: "+p.errorLog; } else { debug = "Path Completed : Computation Time: "+(p.duration).ToString ("0.00")+" ms Path Length "+(p.path == null ? "Null" : p.path.Length.ToString ()) + " Searched Nodes "+p.searchedNodes+"\nSmoothed path length "+(p.vectorPath == null ? "Null" : p.vectorPath.Length.ToString ())+"\nPath number: "+p.pathID; } } else if (logPathResults == PathLog.Heavy || logPathResults == PathLog.InGame || logPathResults == PathLog.OnlyErrors) { if (p.error) { debug = "Path Failed : Computation Time: "+(p.duration).ToString ("0.000")+" ms Searched Nodes "+p.searchedNodes+"\nPath number: "+PathsCompleted+"\nError: "+p.errorLog; } else { debug = "Path Completed : Computation Time: "+(p.duration).ToString ("0.000")+" ms\nPath Length "+(p.path == null ? "Null" : p.path.Length.ToString ()) + "\nSearched Nodes "+p.searchedNodes+"\nSearch Iterations (frames) "+p.searchIterations+"\nSmoothed path length "+(p.vectorPath == null ? "Null" : p.vectorPath.Length.ToString ())+"\nEnd node\n G = "+p.endNode.g+"\n H = "+p.endNode.h+"\n F = "+p.endNode.f+"\n Point "+p.endPoint +"\nStart Point = "+p.startPoint+"\n"+"Start Node graph: "+p.startNode.graphIndex+" End Node graph: "+p.endNode.graphIndex+"\nBinary Heap size at completion: "+(p.open == null ? "Null" : p.open.numberOfItems.ToString ())+"\nPath number: "+p.pathID; } /*if (active.logPathResults == PathLog.Heavy) { Debug.Log (debug); } else { inGameDebugPath = debug; }* } if (logPathResults == PathLog.Normal || logPathResults == PathLog.Heavy || (logPathResults == PathLog.OnlyErrors && p.error)) { Debug.Log (debug); } else if (logPathResults == PathLog.InGame) { inGameDebugPath = debug; }*/ //if ((p.error && logPathResults == PathLog.OnlyErrors) || logPathResults == PathLog.Normal) { // Debug.Log (debug); // } }