static int LogError(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Pathfinding.Path obj = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1); string arg0 = ToLua.CheckString(L, 2); obj.LogError(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/** Puts the Path in queue for calculation. * The callback specified when constructing the path will be called when the path has been calculated. * Usually you should use the Seeker component instead of calling this function directly. * * \param p The path that should be put in queue for calculation * \param pushToFront If true, the path will be pushed to the front of the queue, bypassing all waiting paths and making it the next path to be calculated. * This can be useful if you have a path which you want to prioritize over all others. Be careful to not overuse it though. * If too many paths are put in the front of the queue often, this can lead to normal paths having to wait a very long time before being calculated. */ public static void StartPath (Path p, bool pushToFront = false) { if (active == null) { Debug.LogError ("There is no AstarPath object in the scene"); return; } if (p.GetState() != PathState.Created) { throw new System.Exception ("The path has an invalid state. Expected " + PathState.Created + " found " + p.GetState() + "\n" + "Make sure you are not requesting the same path twice"); } if (active.pathQueue.IsTerminating) { p.Error (); p.LogError ("No new paths are accepted"); return; } if (active.graphs == null || active.graphs.Length == 0) { Debug.LogError ("There are no graphs in the scene"); p.Error (); p.LogError ("There are no graphs in the scene"); Debug.LogError (p.errorLog); return; } p.Claim (active); //Will increment to PathQueue p.AdvanceState (PathState.PathQueue); if (pushToFront) { active.pathQueue.PushFront (p); } else { active.pathQueue.Push (p); } }
/** Puts the Path in queue for calculation. * The callback specified when constructing the path will be called when the path has been calculated. * Usually you should use the Seeker component instead of calling this function directly. */ public static void StartPath (Path p) { if (active == null) { Debug.LogError ("There is no AstarPath object in the scene"); return; } if (p.GetState() != PathState.Created) { throw new System.Exception ("The path has an invalid state. Expected " + PathState.Created + " found " + p.GetState() + "\n" + "Make sure you are not requesting the same path twice"); } if (!active.acceptNewPaths) { p.Error (); p.LogError ("No new paths are accepted"); //Debug.LogError (p.errorLog); //p.ReturnPath (); return; } if (active.graphs == null || active.graphs.Length == 0) { Debug.LogError ("There are no graphs in the scene"); p.Error (); p.LogError ("There are no graphs in the scene"); Debug.LogError (p.errorLog); //p.ReturnPath (); return; } /*MultithreadPath p2 = p as MultithreadPath; if (p2 == null) { Debug.LogError ("Path Not Set Up For Multithreading"); return; }*/ p.Claim (active); lock (pathQueue) { //Will increment to PathQueue p.AdvanceState (PathState.PathQueue); pathQueue.Enqueue (p); if (doSetQueueState) pathQueueFlag.Set (); } }