Esempio n. 1
0
    protected override void build()
    {
        GameObject dataholder = GameObject.Find("DataHolder");

        data = dataholder.GetComponent <PlainBuildingData> ().getDataStruct(foundation);
        placePart <FullFloorPart>("fullFloor", foundation.center);
        placePart <WindowedFloorPart>("windowedFloor", foundation.center + Vector3.up * (data.floorCount - 1) * 3);
        placePart <PlainBuildingCrenellationsPart> ("crenellation", foundation.center + Vector3.up * (data.floorCount) * 3);
    }
Esempio n. 2
0
    public PlainBuildingDataStruct getDataStruct(BuildingFoundation foundation)
    {
        PlainBuildingDataStruct data = new PlainBuildingDataStruct();

        data.sizeX      = foundation.lengthX;
        data.sizeZ      = foundation.lengthZ;
        data.floorCount = Randomiser.intBetween(2, 3);
        GameObject[] windowPrefabs = GenericUtils.loadAllPrefabs("prefabs/windows");
        data.windowPrefab    = windowPrefabs [Random.Range(0, windowPrefabs.Length)];
        data.wallPrefab      = GenericUtils.loadPrefab("plain building", "wallPrefab");
        data.fullFloorPrefab = GenericUtils.loadPrefab("plain building", "fullFloorPrefab");
        data.roofPrefab      = GenericUtils.loadPrefab("plain building", "roofPrefab");
        return(data);
    }
 protected void initData()
 {
     data = transform.root.GetComponent <PlainBuilding> ().data;
 }