Beispiel #1
0
    private void CreatePassageInOneRoom(MazeCell cell, MazeCell otherCell, MazeDirection direction)
    {
        MazePassage passage = Instantiate(passagePrefab) as MazePassage;

        passage.BuildBetween(cell, otherCell, direction);
        passage = Instantiate(passagePrefab) as MazePassage;
        passage.BuildBetween(otherCell, cell, direction.GetOpposite());
        if (cell.room != otherCell.room)
        {
            MazeRoom otherRoom = otherCell.room;
            cell.room.Merge(otherRoom);
            rooms.Remove(otherRoom);
            Destroy(otherRoom);
        }
    }
Beispiel #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());
    }