Пример #1
0
    public OverworldDungeon ConvertTo()
    {
        var output = new OverworldDungeon {
            dungeonData = new TreasureVault()
            {
                numFloors                   = numFloors,
                grid                        = grid,
                maxSocialTier               = maxSocialTier,
                maxDimensions               = maxDimensions,
                encounterThemes             = encounterThemes,
                lootSlotAffinities          = lootSlotAffinities,
                lootPrimaryStatAffinities   = lootPrimaryStatAffinities,
                lootSecondaryStatAffinities = lootSecondaryStatAffinities,
                elementalAffinity           = elementalAffinity,
                bossLootSlotAffinities      = bossLootSlotAffinities
            },
            position = location.ConvertTo(),
            type     = "dungeon",
            entered  = entered,
            seeds    = seeds,
            uuid     = uuid
        };

        for (int i = 0; i < enemyStatBoostEnemies.Count; i++)
        {
            output.dungeonData.enemyStatBoosts.Add(enemyStatBoostEnemies[i], enemyStatBoostStats[i]);
        }
        for (int i = 0; i < enemyBonusAbilityEnemies.Count; i++)
        {
            output.dungeonData.enemyBonusAbilities.Add(enemyBonusAbilityEnemies[i], enemyBonusAbilityAbilities[i].ConvertTo());
        }
        foreach (var room in rooms)
        {
            output.dungeonData.rooms.Add(room.ConvertTo());
        }
        foreach (var monster in monsters)
        {
            output.dungeonData.monsters.Add(monster.ConvertTo(output.dungeonData.rooms, output.dungeonData.monsters));
        }
        foreach (var path in paths)
        {
            output.dungeonData.paths.Add(path.ConvertTo(output.dungeonData.rooms));
        }
        return(output);
    }
Пример #2
0
    public void ConvertTo(GameObject go)
    {
        var worldAutoSaver = go.GetComponent <WorldAutoSaver>();

        foreach (var item in inventory)
        {
            if (item != null)
            {
                PlayerCharacter.localPlayer.inventory.items.Add(item.ConvertTo());
            }
        }
        worldAutoSaver.worldName = name;
        if (savedOverworld)
        {
            OverworldGenerator.loadedPreviouslyMadeWorld = true;
            OverworldGenerator.loadedElevation           = elevation;
            OverworldGenerator.loadedBaseCoords          = baseCoords.ConvertTo();
            OverworldGenerator.loadedDungeons            = new List <OverworldDungeon>();
            foreach (var dungeon in dungeons)
            {
                OverworldGenerator.loadedDungeons.Add(dungeon.ConvertTo());
            }
        }
    }