public override void OnPlace(Tile[] parentTiles) { base.OnPlace(parentTiles); unitsController = GameObject.Find("UnitsController").GetComponent <UnitsController>(); UpdateBuildingModel(); populationController = GameObject.Find("PopulationController").GetComponent(typeof(PopulationController)) as PopulationController; populationController.ChangeTotalNumberOfJobs(tileProperties.buildingProperties.workersRequired); UpdateRoadAccess(); CheckForWorkers(); if ((hasRoadAccess || !tileProperties.buildingProperties.requiresRoadAccess) && foundWorkers) { ChangeRunningValue(true); } else { StartCoroutine("WaitForRoadAccessAndWorkers"); } }
void OnDestroy() { populationController.ChangeTotalNumberOfJobs(tileProperties.buildingProperties.workersRequired * -1); }