private IEnumerator SortAvailableKeepAsideOrderManagersByDistance(Cell <PriorityQueue <float, KeepAsideOrderManager> > rslt) { StockManager stockManager = GameManager.instance.cityBuilderData.stockManager; PriorityQueue <float, KeepAsideOrderManager> rsltQueue = new PriorityQueue <float, KeepAsideOrderManager>(); IEnumerator <KeepAsideOrderManager> keepAsideEnumerator = stockManager.AllKeepAsideOrderManagers(); while (keepAsideEnumerator.MoveNext()) { KeepAsideOrderManager keepAsideManager = keepAsideEnumerator.Current; if (keepAsideManager != null)//On vérifie s'il n'a pas été détruit { float distance = Vector2.Distance(transform.position, keepAsideManager.transform.position); if (distance <= keepAsideManager.availabilityRange)//Pour éviter les calculs inutiles ; si ce n'est pas le cas, il est de toute façon trop loin { FreightAreaIn inArea = keepAsideManager.freightAreaData.freightAreaIn; FreightAreaOut outHome = freightAreaData.freightAreaOut; float roadDistance = RoadsPathfinding.RealDistanceBetween(inArea.road, outHome.road); if (roadDistance > 0.0f && roadDistance <= keepAsideManager.availabilityRange) { rsltQueue.Push(roadDistance, keepAsideManager); } } } yield return(null); } rslt.value = rsltQueue; }