private IEnumerator ProcessAllRefugees() { while (true) { if (queue.Count == 0) { yield return(new WaitForTicks(1)); } else { Refugee current = queue.Dequeue(); current.SetNewDestination(lineStartPos); yield return(new WaitForTicks(timeToProcess)); current.SetNewDestination(finishedProcessingPos); HousingManager.GetInstance().GetBestHouse().AddOccupant(current); } } }
public void AddRefugee(Refugee newRefugee) { queue.Enqueue(newRefugee); newRefugee.SetNewDestination(beforeProcessingPos + new Vector3(Random.Range(-10, 10), 0, Random.Range(-10, 10))); }