public void AddWorkItem(AstarWorkItem item) { this.workItems.AddWorkItem(item); if (!this.workItemLock.Held) { this.workItemLock = this.PausePathfindingSoon(); } }
public void AddWorkItem(AstarWorkItem itm) { this.workItems.AddWorkItem(itm); if (!this.workItemsQueued) { this.workItemsQueued = true; if (!this.isScanning) { this.InterruptPathfinding(); } } }
public void QueueGraphUpdates() { if (!this.graphUpdatesWorkItemAdded) { this.graphUpdatesWorkItemAdded = true; AstarWorkItem workItem = this.graphUpdates.GetWorkItem(); this.AddWorkItem(new AstarWorkItem(delegate { this.graphUpdatesWorkItemAdded = false; this.lastGraphUpdate = Time.realtimeSinceStartup; workItem.init(); }, workItem.update)); } }
public void AddWorkItem(AstarWorkItem item) { workItems.AddWorkItem(item); if (!workItemLock.Held) { workItemLock = PausePathfindingSoon(); } #if UNITY_EDITOR if (!Application.isPlaying) { FlushWorkItems(); } #endif }
/** Will apply queued graph updates as soon as possible, regardless of #limitGraphUpdates. * Calling this multiple times will not create multiple callbacks. * Makes sure DoUpdateGraphs is called as soon as possible.\n * This function is useful if you are limiting graph updates, but you want a specific graph update to be applied as soon as possible regardless of the time limit. * \see FlushGraphUpdates */ public void QueueGraphUpdates () { if (!isRegisteredForUpdate) { isRegisteredForUpdate = true; AstarWorkItem itm = new AstarWorkItem(); itm.init = QueueGraphUpdatesInternal; itm.update = ProcessGraphUpdates; AddWorkItem (itm); } }
/** Add a work item to be processed when pathfinding is paused. * * \see ProcessWorkItems */ public void AddWorkItem (AstarWorkItem itm) { workItems.Enqueue (itm); //Make sure pathfinding is stopped and work items are processed if (!workItemsQueued) { workItemsQueued = true; if (!isScanning) { InterruptPathfinding (); } } #if UNITY_EDITOR //If not playing, execute instantly if (!Application.isPlaying) { FlushWorkItems(); } #endif }