public void AddJob(PositionedJob job) { if (Jobs == null) { if (!Map.Instance.IsDoneGenerating) { return; } Jobs = new List <PositionedJob> [Map.Instance.MapData.Chunks.GetLength(0) * Chunk.ChunkSize, Map.Instance.MapData.Chunks.GetLength(1) * Chunk.ChunkSize, Map.Instance.MapData.Chunks.GetLength(2) * Chunk.ChunkSize]; } if (!OpenJobs.ContainsKey(job.GetJobType())) { OpenJobs.Add(job.GetJobType(), new PriorityQueue <PositionedJob>()); } OpenJobs[job.GetJobType()].Enqueue(job, 1); if (Jobs[(int)job.Position.x, (int)job.Position.y, (int)job.Position.z] == null) { Jobs[(int)job.Position.x, (int)job.Position.y, (int)job.Position.z] = new List <PositionedJob>(); } Jobs[(int)job.Position.x, (int)job.Position.y, (int)job.Position.z].Add(job); }
public void AcceptJob(PositionedJob job) { OpenJobs[job.GetJobType()].Dequeue(job); }