BoardManager

The BoardManager class already keeps references to the floor and wall tiles. Rather than having our DungeonManager class keep the same references, we will send our dungeon dictionary to the BoardManager class and have it build the Dungeon Board. We will need to update our BoardManager class for this. Open up BoardManager.cs for editing and make the changes seen in Code Snip 4.7:

29 public GameObject exit;
…
33 public GameObject[] outerWallTiles;
… 
40 private Transform dungeonBoardHolder;
41 private Dictionary<Vector2, Vector2> dungeonGridPositions; … 69 private void addTiles(Vector2 tileToAdd) { 70 if (!gridPositions.ContainsKey (tileToAdd)) { 71 gridPositions.Add (tileToAdd, tileToAdd); 72 GameObject toInstantiate = floorTiles [Random.Range ...

Get Procedural Content Generation for Unity Game Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.