コード例 #1
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);
            }
        }
コード例 #2
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());
        }