public void ConstructionHandler() { if (beginConstruction) { //Create The Building BuildingCore.Type tester = BuildingCore.Type.Barracks; switch (type) { case Type.BarracksBuilder: tester = BuildingCore.Type.Barracks; break; case Type.GranaryBuilder: tester = BuildingCore.Type.Granary; break; case Type.WorkshopBuilder: tester = BuildingCore.Type.Workshop; break; } regionT.GetChild(Helper.ConvertRegionNameToID(currentLocation)).GetComponent <RegionCore>().ConstructBuilding(tester); Debug.Log(this + " Builders have finished construction!"); KillUnit(); } }
public void ConstructBuilding(BuildingCore.Type type) { GameObject newBuilding = Instantiate(building, new Vector3((transform.position.x + 25) + 50 * ownedBuildings.Count, 1, (transform.position.z + 25) + 50 * ownedBuildings.Count), new Quaternion(0, 0, 0, 90), transform); BuildingCore newBuildingCore = newBuilding.GetComponent <BuildingCore>(); newBuildingCore.masterRegion = regionHandle; newBuildingCore.type = type; GetBuildingsInRegion(); }