private void CheckCurrentTileContents() { Tile currentTile = Utils.TileAt(Position.x, Position.y); //Removing any existing stockpiles from the tile StockpileCreator.RemoveStockpileFromTile(currentTile); //there must be no other items or vegetation on the tile if (currentTile.Contents.HasItem) { RemoveItemFromTileUnderConstructionPlan(); return; } if (currentTile.Contents.StaticObject is ICuttable vegetation) { Job job = new CutJob(vegetation, Position); job.JobResultHandler += OnTileClearJobFinish; _jobs.Add(job); JobSystem.GetInstance().AddJob(job); return; } foreach (var ingredient in Ingredients) { for (int i = ingredient.count; i > 0; i--) { CreateHaulingJobForIngredient(SearchEngine.GetTypeDerivativeOf <Item>(ingredient.itemName)); } } }
private static IJob CreateNewJob(DataUnit data) { IJob job = null; var items = new List <DataUnit> { data }; switch (data.LayerId) { case Constants.EmptyLayerId: job = new EmptyMoveJob(items); break; case Constants.CoolingLayerId: job = new CoolingJob(items); break; case Constants.EvaporationLayerId: job = new EvaporationJob(items); break; case Constants.CoolingPointLayerId: job = new PointCoolingJob(items); break; default: if (data.Id == DataUnitTypes.PointCut) { job = new PointCutJob(items); } else if (data.Id == DataUnitTypes.PointPierce) { job = new PierceJob(items); } else { job = new CutJob(items); } break; } return(job); }