Example #1
0
    private void GenFirstCell(List <MazeCell> activeCells)
    {
        MazeCell cell = CreateCell(RandomCoord());

        cell.InitWithRoom(CreateRoom(-1));
        activeCells.Add(cell);
    }
Example #2
0
    private void CreatePassage(MazeCell cell, MazeCell otherCell, MazeDirection direction)
    {
        MazePassage prefab  = Random.Range(0.0f, 1.0f) < doorProbability ? doorPrefab : passagePrefab;
        MazePassage passage = Instantiate(prefab) as MazePassage;

        passage.BuildBetween(cell, otherCell, direction);
        if (prefab is MazeDoor)
        {
            otherCell.InitWithRoom(CreateRoom(cell.room.settingsIndex));
        }
        else
        {
            otherCell.InitWithRoom(cell.room);
        }
        passage = Instantiate(prefab) as MazePassage;
        passage.BuildBetween(otherCell, cell, direction.GetOpposite());
    }