Пример #1
0
    private void CreatePassageInSameRoom(LevelCell cell, LevelCell otherCell, LevelDirection direction, Canvas twoDMap)
    {
        LevelPassage passage = Instantiate(passagePrefab) as LevelPassage;

        passage.Initialize(cell, otherCell, direction);
        passage = Instantiate(passagePrefab) as LevelPassage;
        passage.Initialize(otherCell, cell, direction.GetOpposite());
        if (cell.room != otherCell.room)
        {
            LevelRoom joinRoom = otherCell.room;
            cell.room.Join(joinRoom);
            rooms.Remove(joinRoom);
            Destroy(joinRoom);
        }
        CreateTwoDPassage(cell, twoDMap, direction);
    }
Пример #2
0
    private void CreatePassage(LevelCell cell, LevelCell otherCell, LevelDirection direction, Canvas twoDMap, bool existingCell)
    {
        LevelPassage passage = Instantiate(passagePrefab) as LevelPassage;

        passage.Initialize(cell, otherCell, direction);
        passage = Instantiate(passagePrefab) as LevelPassage;
        if (!existingCell)
        {
            if (Random.value < newRoomProbability)
            {
                otherCell.InitializeCell(CreateRoom(cell.room.matIndex));
            }
            else
            {
                otherCell.InitializeCell(cell.room);
            }
            CreateTwoDCell(otherCell, twoDMap);
        }
        passage.Initialize(otherCell, cell, direction.GetOpposite());
        CreateTwoDPassage(cell, twoDMap, direction);
    }