Esempio n. 1
0
    private void GenerateDungeonFeatures(int direction)
    {
        // Generate architecture for each tree quad recursively
        ArchitectureGenerator architecture = new ArchitectureGenerator();

        architecture.GenerateArchitecture(dungeonGenerator.quadTree);

        // Generate stairs
        StairGenerator stairs = new StairGenerator();

        stairs.Generate();

        // If we cannot solve the level, we need to generate a different one
        if (!LevelIsSolvable())
        {
            Debug.LogError("Dungeon level cannot be solved. Genrating again...");
            GenerateDungeon(direction);
            return;
        }

        // Generate player
        PlayerGenerator player = new PlayerGenerator();
        Stair           stair  = direction == -1 ? grid.stairDown : grid.stairUp;

        player.GenerateAtPos(stair.x, stair.y);

        // Generate furniture
        FurnitureGenerator furniture = new FurnitureGenerator();

        furniture.Generate();

        // Generate monsters
        MonsterGenerator monsters = new MonsterGenerator();

        monsters.Generate();
        //monsters.GenerateSingle();

        // Generate chests
        ChestGenerator chests = new ChestGenerator();

        chests.Generate();

        // Generate items
        ItemGenerator items = new ItemGenerator();

        items.Generate();
    }