Ejemplo n.º 1
0
        public static MeshDraft BuildingDraft(float width, float length, int floorCount, bool hasAttic, Color wallColor)
        {
            float height = FloorHeight*floorCount + SocleHeight + (hasAttic ? AtticHeight : 0);
            BuildingGenerator.wallColor = wallColor.WithA(0);

            var draft = new MeshDraft {name = "Building"};
            var corners = new Vector3[]
            {
                Vector3.left*length/2 + Vector3.back*width/2,
                Vector3.right*length/2 + Vector3.back*width/2,
                Vector3.right*length/2 + Vector3.forward*width/2,
                Vector3.left*length/2 + Vector3.forward*width/2
            };

            commonPanelConstructors[PanelType.Entrance] = panelConstructors[PanelType.Entrance].GetRandom();
            commonPanelConstructors[PanelType.EntranceWall] = panelConstructors[PanelType.EntranceWall].GetRandom();

            List<FloorPlan> facadePlan0 = FacadeGenerator(length, floorCount, hasAttic, true, true);
            draft.Add(Facade(corners[0], Vector3.right, facadePlan0));
            List<FloorPlan> facadePlan1 = FacadeGenerator(width, floorCount, hasAttic);
            draft.Add(Facade(corners[1], Vector3.forward, facadePlan1));
            List<FloorPlan> facadePlan2 = FacadeGenerator(length, floorCount, hasAttic, false, true);
            draft.Add(Facade(corners[2], Vector3.left, facadePlan2));
            List<FloorPlan> facadePlan3 = FacadeGenerator(width, floorCount, hasAttic);
            draft.Add(Facade(corners[3], Vector3.back, facadePlan3));

            draft.Add(Roof(corners[0], corners[1], corners[2], corners[3], Vector3.up*height));

            var basement = MeshDraft.Quad(corners[0], corners[1], corners[2], corners[3]);
            basement.Paint(roofColor);
            draft.Add(basement);

            return draft;
        }