Пример #1
0
        public void Configure()
        {
            int currentYPosition = 0;

            this.lanes.Clear();
            this.ParentArea = configuration.HighwayOptions.GameScreenArea;
            this.SetPosition(configuration.HighwayOptions.GameScreenArea);

            List <LaneSetting> laneSettings = configuration.HighwayOptions.LaneCollection;

            bottomCurb = createBottomCurb(currentYPosition, out currentYPosition);

            foreach (LaneSetting laneSetting in laneSettings)
            {
                int yPositionAfter;
                int yPositionBefore = currentYPosition;

                Lane lane = createLane(laneSetting, yPositionBefore, out yPositionAfter);
                currentYPosition = yPositionAfter;

                lanes.Add(lane);
            }

            topCurb = createTopCurb(currentYPosition);

            createPedestrian();
        }
Пример #2
0
        private SideCurb createTopCurb(int yBefore)
        {
            int yCoord = yBefore;

            Rectangle area = new Rectangle();

            area.X      = 0;
            area.Y      = 0;
            area.Width  = this.ParentArea.Width;
            area.Height = yCoord + configuration.HighwayOptions.LaneWidth + 1;

            SideCurb curb = new SideCurb();

            curb.SetPosition(area);
            return(curb);
        }
Пример #3
0
        private SideCurb createBottomCurb(int yBefore, out int yAfter)
        {
            int yCoord = yBefore;

            yCoord = this.ParentArea.Height - configuration.HighwayOptions.BottomCurbWidth;

            // Get the area for the curb to draw.
            Rectangle area = new Rectangle();

            area.X      = 0;
            area.Y      = yCoord;
            area.Width  = this.ParentArea.Width;
            area.Height = configuration.HighwayOptions.BottomCurbWidth;

            // Create the curb.
            SideCurb curb = new SideCurb();

            curb.SetPosition(area);

            // Record the next drawing position.
            yAfter = yCoord - configuration.HighwayOptions.LaneWidth;
            return(curb);
        }