예제 #1
0
    private void CreatePassageInSameRoom(mazeCell cell, mazeCell otherCell, mazeDirection direction)
    {
        mazePassage passage = Instantiate(passagePrefab) as mazePassage;

        passage.Initialize(cell, otherCell, direction);
        passage = Instantiate(passagePrefab) as mazePassage;
        passage.Initialize(otherCell, cell, direction.GetOpposite());

        if (cell.room != otherCell.room)
        {
            mazeRoom roomToAssimilate = otherCell.room;
            cell.room.Assimilate(roomToAssimilate);
            rooms.Remove(roomToAssimilate);
            Destroy(roomToAssimilate);
        }
    }
예제 #2
0
    private void CreatePassage(mazeCell cell, mazeCell otherCell, mazeDirection direction)
    {
        mazePassage prefab  = Random.value < doorProbability ? doorPrefab : passagePrefab;
        mazePassage passage = Instantiate(prefab) as mazePassage;

        passage.Initialize(cell, otherCell, direction);
        passage = Instantiate(prefab) as mazePassage;
        if (passage is mazeDoor)
        {
            otherCell.Initialize(CreateRoom(cell.room.settingsIndex));
        }
        else
        {
            otherCell.Initialize(cell.room);
        }

        passage.Initialize(otherCell, cell, direction.GetOpposite());
    }