public EstateJob(Tile jobTile, EstateJobType jobType, float jobTime, Action <EstateJob> jobOnCompletedCallback, Fixture fixturePrototype = null, Tile pickupTile = null) { this.jobTile = jobTile; this.JobType = jobType; this.JobTime = jobTime; this.jobOnCompletedCallback = jobOnCompletedCallback; this.Fixture = fixturePrototype; this.requiredHaulableItems = new HaulableItem[] { }; //if (JobType == EstateJobType.BUILD) //this.requiredHaulableItems = FixturePrototype.requiredHaulableItems; if (JobType == EstateJobType.HAUL) { this.pickupTile = pickupTile; } }
public EstateJob(Tile jobTile, EstateJobType jobType, float jobTime, Action <EstateJob> jobOnCompletedCallback, Vector2 jobOffset, Fixture fixturePrototype = null, Tile pickupTile = null) { this.jobTile = WorldController.Instance.World.GetTileAt(jobTile.X + (int)jobOffset.x, jobTile.Y + (int)jobOffset.y); this.JobType = jobType; this.JobTime = jobTime; this.jobOnCompletedCallback = jobOnCompletedCallback; this.Fixture = fixturePrototype; this.requiredHaulableItems = new HaulableItem[] { }; //if (JobType == EstateJobType.BUILD) //this.requiredHaulableItems = FixturePrototype.requiredHaulableItems; if (JobType == EstateJobType.HAUL) { this.pickupTile = pickupTile; } }
bool JobTileAlreadyHasJobOfType(Tile jobTile, EstateJobType type) { //FIXME: For now we are just checking to see if there is any job in that tile and aborting //Later on this will need to be more complex were we cancel jobs if they can be overwritten, //i.e cleaning and gardening jobs can be cancelled if a construction job is placed on that tile List <EstateJob> allJobs = GetAllJobs(); foreach (EstateJob job in allJobs) { if (job.jobTile == jobTile) { return(true); } } return(false); }