void GenerateSegmentParams(BuildingParams buildingParams) { foundationParams = new FoundationParams(buildingParams); for (int i = 0; i < floorCount; i++) { if (i == 0) { baseParams[i] = new BaseParams(foundationParams.finalSize, buildingParams, GetOpeningStyle(buildingParams), GetOpeningStyle(buildingParams)); baseParams[i].GenerateWindowsAndDoorParams(buildingParams); } else { //2 auktas nustato visu sekanciu aukstu langu isvaizda, pirmas aukstas turi savo baseParams[i] = new BaseParams(baseParams[i - 1].finalSize, buildingParams, i, i >= 2 ? baseParams[i - 1].windowStyle : GetOpeningStyle(buildingParams)); if (i == 1) { baseParams[i].GenerateWindowsParams(buildingParams); } else { baseParams[i].GenerateWindowsParams(buildingParams, baseParams[i - 1].windowParams[0].finalSize); } } } atticParams = new AtticParams(baseParams[floorCount - 1].finalSize); atticParams.GenerateWindowsParams(buildingParams, baseParams[floorCount - 1]); roofParams = new RoofParams(atticParams.finalSize, baseParams[floorCount - 1].finalSize); chimneyParams = new ChimneyParams(roofParams, baseParams[floorCount - 1]); }
Vector3 GetFinalPos(RoofParams roofParams, Vector3 baseFinalSize) { float x = baseFinalSize.x / 4; float y = roofParams.finalSize.y / 4 + roofParams.roofThiccness; float z = roofParams.finalSize.z / 2; return(new Vector3(x, y, z)); }
public void Test_CalculateRoofPosPositive() { RoofParams roofParams = new RoofParams(Vector3.zero, Vector3.zero); Vector3 lastBaseSize = new Vector3(2, 2, 2); Vector3 finalRoofSize = new Vector3(2.5f, 3, 2.5f); Vector3 expectedPos = new Vector3(0, 2, -0.25f); Vector3 pos = roofParams.GetFinalPosition(lastBaseSize, finalRoofSize); Assert.That(pos, Is.EqualTo(expectedPos)); }
public void Test_CalculateRoofSizePositive() { RoofParams roofParams = new RoofParams(Vector3.zero, Vector3.zero); Vector3 atticSize = new Vector3(2, 2, 2); float roofThiccness = 0.1f; float zToAdd = 0.3f; Vector3 expectedSize = new Vector3(roofThiccness, 4, 2 + zToAdd); Vector3 size = roofParams.GetFinalSize(atticSize, zToAdd, roofThiccness); Assert.That(size, Is.EqualTo(expectedSize)); }
public Roof(Material material, BaseParams lastBaseParams, RoofParams _roofParams, Transform parent) { roofParams = _roofParams; CreateBase(material, lastBaseParams, parent); }
public ChimneyParams(RoofParams roofParams, BaseParams lastBaseParams) { finalSize = GetFinalSize(); finalPos = GetFinalPos(roofParams, lastBaseParams.finalSize); baseObjSize = BaseObjSizes.chimneySize; }