예제 #1
0
    private void CreatePassageInSameRoom(DungeonCell cell, DungeonCell otherCell, DungeonDirection direction) //Combines rooms into larger rooms
    {
        DungeonPassage passage = Instantiate(passagePrefab) as DungeonPassage;

        passage.Initialize(cell, otherCell, direction);
        passage = Instantiate(passagePrefab) as DungeonPassage;
        passage.Initialize(otherCell, cell, direction.GetOpposite());
        if (cell.room != otherCell.room)
        {
            DungeonRoom roomToCombine = otherCell.room;
            cell.room.Combine(roomToCombine);
            rooms.Remove(roomToCombine);
            Destroy(roomToCombine);
        }
    }
예제 #2
0
    private void CreateWall(DungeonCell cell, DungeonCell otherCell, DungeonDirection direction) //Creates a wall between two cells
    {
        DungeonWall wall = Instantiate(wallPrefab) as DungeonWall;

        wall.Initialize(cell, otherCell, direction);
        if (otherCell != null)
        {
            wall.Initialize(otherCell, cell, direction.GetOpposite());
        }
        //Stagger walls z value to prevent lighting glitch
        Vector3 wallTrans = wall.transform.position;

        wallTrans.z            += Random.Range(-.5f, .5f);
        wall.transform.position = wallTrans;
    }
예제 #3
0
    private void CreatePassage(DungeonCell cell, DungeonCell otherCell, DungeonDirection direction) //Creates a passage between cells
    {
        DungeonPassage prefab  = Random.value < doorProbability ? doorPrefab : passagePrefab;
        DungeonPassage passage = Instantiate(prefab) as DungeonPassage;

        passage.Initialize(cell, otherCell, direction);
        if (passage is DungeonDoor)
        {
            otherCell.Initialize(CreateRoom(cell.room.settingIndex));
        }
        else
        {
            otherCell.Initialize(cell.room);
        }
        passage = Instantiate(prefab) as DungeonPassage;
        passage.Initialize(otherCell, cell, direction.GetOpposite());
    }