public BuildingBuilder()
        {
            this.random = new Random();

            var windowSize  = new Size2(8, 8);
            var textureSize = new Size2(512, 512);

            this.storyCalculator         = new StoryCalculator(textureSize, windowSize, 0.05f);
            this.buildingBuilder         = new BuildingBlockBuilder(this.storyCalculator);
            this.columnedBuildingBuilder = new ColumnedBuildingBlockBuilder(this.storyCalculator);
        }
Beispiel #2
0
        public ColumnedPanel(
            Vector3 position,
            int storiesHigh,
            IEnumerable <int> storyWidths,
            Panel.Plane plane,
            Panel.Facing facing,
            Color mod,
            StoryCalculator storyCalc)
        {
            var panels = new List <IGeometry>();

            bool textured = true;

            var origin = new Vector2(0.0f);

            foreach (var width in storyWidths)
            {
                var tx1 = storyCalc.RandomPosition();
                var tx2 = new Vector2(tx1.X + width, tx1.Y + storiesHigh);
                if (!textured)
                {
                    tx1 = origin;
                    tx2 = origin;
                }

                var direction = facing == Panel.Facing.Out ? 1.0f : -1.0f;

                var size = new Vector2(width * storyCalc.StorySize * direction, storiesHigh * storyCalc.StorySize * direction);
                panels.Add(new Panel(position, size, plane, facing, storyCalc.ToTexture(tx1), storyCalc.ToTexture(tx2), mod));

                switch (plane)
                {
                case Panel.Plane.XY:
                case Panel.Plane.XZ:
                    position.X += size.X;
                    break;

                case Panel.Plane.YZ:
                    position.Z += size.X;
                    break;

                default:
                    throw new ArgumentOutOfRangeException("plane");
                }

                textured = !textured;
            }

            this.aggregate = new AggregateGeometry(panels);
        }