Esempio n. 1
0
    private void DoFirstGenerationStep(List <MazeCell> activeCells)
    {
        MazeCell newcell = CreateCell(RandomCoordinates);

        newcell.Initialized(CreateRoom(-1));
        activeCells.Add(newcell);
    }
Esempio n. 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());
    }
Esempio n. 3
0
    /// <summary>
    /// Creates the passage.
    /// Passage has a Initialize on either side.
    /// </summary>
    /// <param name="currentCell">Current cell.</param>
    /// <param name="neighbor">Neighbor.</param>
    /// <param name="direction">Direction.</param>
    void CreatePassage(MazeCell currentCell, MazeCell neighbor, MazeDirection direction)
    {
        MazePassage prefab  = Random.value < mDoorProbability ? mDoorPrefab : mPassgaePrefab;
        MazePassage passage = Instantiate(prefab) as MazePassage;

        passage.Initialize(currentCell, neighbor, direction);
        passage = Instantiate(prefab) as MazePassage;
        if (passage is MazeDoor)
        {
            neighbor.Initialized(CreateRoom(currentCell.mRoom.mSettingsIndex));
            mRoomCreatedTest += 1;
        }
        else
        {
            neighbor.Initialized(currentCell.mRoom);
        }
        passage.Initialize(neighbor, currentCell, direction.GetOpposite());
    }