//================================================================================= // Function to create the passages in the maze //================================================================================= private void CreatePassage(MazeCell cell, MazeCell otherCell, MazeDirection direction) { MazePassage passage = Instantiate(passagePrefab) as MazePassage; // adds an instance of the passage prefab passage.Initialise(cell, otherCell, direction); passage = Instantiate(passagePrefab) as MazePassage; passage.Initialise(otherCell, cell, direction.GetOpposite()); }
void CreatePassageInSameRoom(MazeCell _cell, MazeCell _otherCell, mazeDirection _direction) { MazePassage mazePassage = Instantiate(mazePassPrefab); mazePassage.Initialise(_cell, _otherCell, _direction); mazePassage = Instantiate(mazePassPrefab); mazePassage.Initialise(_otherCell, _cell, _direction.GetOpposite()); }
void CreatePassage(MazeCell _cell, MazeCell _otherCell, mazeDirection _direction) { MazePassage prefabPass = Random.value < doorProbability ? mazeDoorPrefab : mazePassPrefab; MazePassage mazePassage = Instantiate(prefabPass) as MazePassage; mazePassage.Initialise(_cell, _otherCell, _direction); if (mazePassage is MazeDoor) { //Create a new room, excluding the last index _otherCell.SetRoom((CreateRoom(_cell.room.settingIndex))); } else { //initialize with the ongoing room _otherCell.SetRoom(_cell.room); } mazePassage = Instantiate(prefabPass) as MazePassage; mazePassage.Initialise(_otherCell, _cell, _direction.GetOpposite()); }