//Create passage between the current cell and the neighbor public void CreatePassage(Cell cell, Cell otherCell, MapDirection dir) { //Instantiate the passage in the cell's position, facing the other cell MapFloor passage = Instantiate(passagePrefab) as MapFloor; passage.Initialise(cell, otherCell, dir); //Instantiate another passage in the other cell's position, facing the current cell passage = Instantiate(passagePrefab) as MapFloor; passage.Initialise(otherCell, cell, dir.GetOpposite()); }
//Create wall between the current cell and the other cell, called if other cell is null void CreateWall(Cell cell, Cell otherCell, MapDirection dir) { //Instantiate a wall on the correct side of the cell MapWall wall = Instantiate(wallPrefab) as MapWall; wall.Initialise(cell, otherCell, dir); //Instantiate a wall on the opposite side of the other cell if it isn't null if (otherCell != null) { wall = Instantiate(wallPrefab) as MapWall; wall.Initialise(otherCell, cell, dir.GetOpposite()); } }