예제 #1
0
파일: Maze.cs 프로젝트: mayxen/Maze-Game
    private void DoFirstGenerationStep(List <MazeCell> activeCells)
    {
        MazeCell newcell = CreateCell(RandomCoordinates);

        newcell.Initialized(CreateRoom(-1));
        activeCells.Add(newcell);
    }
예제 #2
0
파일: Maze.cs 프로젝트: mayxen/Maze-Game
    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());
    }
예제 #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());
    }