private void CreatePassageInSameRoom(MuseumCell cell, MuseumCell otherCell, CellDirection direction) { MuseumRoom room = cell.room; bool isDisplayCase = Random.value < displayCaseProbability; if (isDisplayCase) { MuseumDisplayCase displayCase = Instantiate(displayCasePrefab) as MuseumDisplayCase; displayCase.Initialize(cell, otherCell, direction); displayCase = Instantiate(displayCasePrefab) as MuseumDisplayCase; displayCase.Initialize(otherCell, cell, direction.GetOpposite()); if (paintings.Length > 0) { string paintingName = paintings[(int)Random.Range(0, paintings.Length)]; displayCase.LoadTexture(paintingName); } } else { MuseumPassage passage = Instantiate(passagePrefab) as MuseumPassage; passage.Initialize(cell, otherCell, direction); passage = Instantiate(passagePrefab) as MuseumPassage; passage.Initialize(otherCell, cell, direction.GetOpposite()); } }
private void CreatePassage(MuseumCell cell, MuseumCell otherCell, CellDirection direction) { MuseumPassage prefab = Random.value < entryProbability ? entryPrefab : passagePrefab; MuseumPassage passage = Instantiate(prefab) as MuseumPassage; passage.Initialize(cell, otherCell, direction); passage = Instantiate(prefab) as MuseumPassage; if (passage is MuseumEntry) { otherCell.Initialize(CreateMuseumRoom()); } else { otherCell.Initialize(cell.room); } passage.Initialize(otherCell, cell, direction.GetOpposite()); }