示例#1
0
        private void CreateWall(BaseCell cell, BaseCell otherCell, CompassDirection direction)
        {
            CellWall wall = Instantiate(ip.wallPrefab) as CellWall;

            wall.Initialize(cell, otherCell, direction);
            if (otherCell != null)
            {
                wall = Instantiate(ip.wallPrefab) as CellWall;
                wall.Initialize(otherCell, cell, direction.GetOpposite());
            }
        }
示例#2
0
        private void CreatePassageInSameRoom(BaseCell cell, BaseCell otherCell, CompassDirection direction)
        {
            CellPassage passage = Instantiate(ip.passagePrefab) as CellPassage;

            passage.Initialize(cell, otherCell, direction);
            passage = Instantiate(ip.passagePrefab) as CellPassage;
            passage.Initialize(otherCell, cell, direction.GetOpposite());
            if (cell.room != otherCell.room)
            {
                Room roomToMerge = otherCell.room;
                cell.room.Merge(roomToMerge);
                rooms.Remove(roomToMerge);
                Destroy(roomToMerge);
            }
        }
示例#3
0
        private void CreatePassage(BaseCell cell, BaseCell otherCell, CompassDirection direction)
        {
            CellPassage prefab  = Random.value < ip.doorProbability ? ip.doorPrefab : ip.passagePrefab;
            CellPassage passage = Instantiate(prefab) as CellPassage;

            passage.Initialize(cell, otherCell, direction);
            passage = Instantiate(prefab) as CellPassage;
            if (passage is Door)
            {
                otherCell.Initialize(CreateRoom(-1 /*cell.room.settingsIndex*/));
            }
            else
            {
                otherCell.Initialize(cell.room);
            }
            passage.Initialize(otherCell, cell, direction.GetOpposite());
        }