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 (0, floorTiles.Length)]; 73 GameObject instance = Instantiate (toInstantiate, new Vector3 (tileToAdd.x, tileToAdd.y, 0f), Quaternion.identity) as GameObject; 74 instance.transform.SetParent (boardHolder); 75...