Ejemplo n.º 1
0
        public override void AddObjects()
        {
            var obstacleTemplate = new Obstacle(
                this.detailsConfiguration.ObstacleVisualization);
                //, this.detailsConfiguration.ObstacleForegroundColor
                //, this.detailsConfiguration.ObstacleBackgroundColor);

            var freeSpaceTemplate = new FreeSpace(
                this.detailsConfiguration.FreeSpaceVisualization);
                //, this.detailsConfiguration.FreeSpaceForegroundColor
                //, this.detailsConfiguration.FreeSpaceBackgroundColor);

            this.gameObjectsGenerator.GenerateObjects(this.labyrinth, obstacleTemplate, freeSpaceTemplate);
        }
Ejemplo n.º 2
0
        public void GenerateObjects(Labyrinth labyrinth, Obstacle obstacle, FreeSpace freeSpace)
        {
            for (int i = 0; i < labyrinth.Columns; i++)
            {
                for (int j = 0; j < labyrinth.Rows; j++)
                {
                    int randomNumber = this.randomGenerator.Next(2);
                    IGameObject currentObject;

                    if (randomNumber == 1)
                    {
                        currentObject = (Obstacle)obstacle.Clone();
                    }
                    else
                    {
                        currentObject = (FreeSpace)freeSpace.Clone();
                    }

                    labyrinth[i, j] = currentObject;
                }
            }
        }