Abstract Factory

In this task, the base code has been expanded to include a very simple level generator. The levels data is kept in the Maze class which in turn consists of different rooms. Each room, in turn, is built from tiles.

Currently the whole level generation process takes place in the create maze method. Your task is to separate the level building logic from the code responsible for creating building blocks for the level. So the create maze should decide where each part goes, but there should be no direct calls to constructors. Instead, new objects should be received from a factory. This way all the level building blocks can be swapped out by choosing a different factory. You will find additional instructions and a break down of the task within the class MazeGame. 

The map system is defined in the Map file. The file consists of classes Maze, MapSite, Maptile, Room, Ground and Portal. A brief description of the map system is given in MazeGame comments. You do not need to modify anything in the Map file to complete this task.

The base package works as a stand-alone pack. You can also use it to expand what you have created in previous tasks. When doing so, be sure to not overwrite your Command, InputHandler and TileBasedMovement scripts.

Base code: [Package]

Before submitting, make sure that in your solution:

  • The CreateMaze method gets all the building blocks from the factory.
  • MazeGame.Start uses singleton or service locator to access a factory.
  • MazeGame does not have any fields for GameObjects/Prefabs. These should be moved to a factory.
  • Add a second factory that will change the look of the game. Selecting factories does not have to be available in the game UI.

 

;