Exemplo n.º 1
0
    public static SavedDungeon ConvertFrom(OverworldDungeon dungeon)
    {
        if (dungeon.dungeonData == null)
        {
            return new SavedDungeon()
                   {
                       location = SavedVector2.ConvertFrom(dungeon.position),
                       uuid     = dungeon.uuid
                   }
        }
        ;
        var output = new SavedDungeon {
            entered                     = true,
            location                    = SavedVector2.ConvertFrom(dungeon.position),
            numFloors                   = dungeon.dungeonData.numFloors,
            grid                        = dungeon.dungeonData.grid,
            maxSocialTier               = dungeon.dungeonData.maxSocialTier,
            maxDimensions               = dungeon.dungeonData.maxDimensions,
            encounterThemes             = dungeon.dungeonData.encounterThemes,
            seeds                       = dungeon.seeds,
            uuid                        = dungeon.uuid,
            lootSlotAffinities          = dungeon.dungeonData.lootSlotAffinities,
            lootPrimaryStatAffinities   = dungeon.dungeonData.lootPrimaryStatAffinities,
            lootSecondaryStatAffinities = dungeon.dungeonData.lootSecondaryStatAffinities,
            elementalAffinity           = dungeon.dungeonData.elementalAffinity,
            bossLootSlotAffinities      = dungeon.dungeonData.bossLootSlotAffinities
        };

        foreach (var kvp in dungeon.dungeonData.enemyStatBoosts)
        {
            output.enemyStatBoostEnemies.Add(kvp.Key);

            output.enemyStatBoostStats.Add(kvp.Value);
        }
        foreach (var kvp in dungeon.dungeonData.enemyBonusAbilities)
        {
            output.enemyBonusAbilityEnemies.Add(kvp.Key);
            output.enemyBonusAbilityAbilities.Add(SavedActiveAbility.ConvertFrom(kvp.Value));
        }
        foreach (var room in dungeon.dungeonData.rooms)
        {
            output.rooms.Add(SavedRoom.ConvertFrom(room));
        }
        foreach (var monster in dungeon.dungeonData.monsters)
        {
            output.monsters.Add(SavedMonsterData.ConvertFrom(monster));
        }
        foreach (var path in dungeon.dungeonData.paths)
        {
            output.paths.Add(SavedVaultPath.ConvertFrom(path));
        }
        return(output);
    }
Exemplo n.º 2
0
 public static void OverwriteDungeonData(OverworldDungeon dungeonData)
 {
     if (lastSavedWorld == null)
     {
         return;
     }
     for (int i = 0; i < lastSavedWorld.dungeons.Count; i++)
     {
         var dungeon = lastSavedWorld.dungeons[i];
         if (dungeon.uuid == dungeonData.uuid)
         {
             lastSavedWorld.dungeons[i] = SavedDungeon.ConvertFrom(dungeonData);
             break;
         }
     }
 }
Exemplo n.º 3
0
 private static IEnumerator AddDungeons(int number)
 {
     for (int i = 0; i < number; i++)
     {
         var position = OverworldPathfinding.GetValidRandomPosition();
         var owd      = new OverworldDungeon()
         {
             position = new Vector2(position.x, position.z)
         };
         landmarks.Add(owd);
         var obj = Object.Instantiate(OverworldGenerator.instance.dungeonPrefab, position, new Quaternion());
         obj.GetComponent <DungeonEntrance>().dungeonLevel = PlayerCharacter.localPlayer.GetComponent <ExperienceGainer>().level;
         obj.GetComponent <DungeonEntrance>().dungeonData  = owd;
         OverworldGenerator.instance.UpdateProgress(11, (float)i / number);
         yield return(null);
     }
 }
Exemplo n.º 4
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);
    }