Example #1
0
    private void CreatePassageInSameRoom(MazeCell cell, MazeCell other, MazeDirecction direction)
    {
        MazePassage passage = Instantiate(PassagePrefab);

        passage.Inicialize(cell, other, direction);
        passage = Instantiate(PassagePrefab);
        passage.Inicialize(other, cell, direction.GetOpposite());

        if (cell.Room != other.Room)
        {
            MazeRoom roomToAssimilate = other.Room;
            cell.Room.Assimilate(roomToAssimilate);
            rooms.Remove(roomToAssimilate);
            Destroy(roomToAssimilate);
        }
    }
Example #2
0
    private void CreatePassage(MazeCell cell, MazeCell otherCell, MazeDirecction direcction)
    {
        MazePassage prefab  = Random.value < DoorProbability ? DoorPrefab : PassagePrefab;
        MazePassage passage = Instantiate(prefab);

        passage.Inicialize(cell, otherCell, direcction);
        passage = Instantiate(prefab);
        if (passage is MazeDoor)
        {
            otherCell.Initialized(CreateRoom(cell.Room.SettingsIndex));
        }
        else
        {
            otherCell.Initialized(cell.Room);
        }
        passage.Inicialize(otherCell, cell, direcction.GetOpposite());
    }