public void AddSpawnedMonster(long uniqueId, HeroConfig.BasicStats basicStats, Entity entity) { if (spawnedMonstersThatAreNotEnvironmentRole.Contains(uniqueId)) { return; } if (basicStats.ShowRole() == EntityRole.Environment) { return; } spawnedMonstersThatAreNotEnvironmentRole.Add(uniqueId); CacheTemplateArgsComponent argsComponent = entity.GetComponent <CacheTemplateArgsComponent>(); if (argsComponent == null) { return; } SpawnSourceInfo source = new DungeonSystemSpawnSourceInfo(); source = argsComponent.TemplateArgs.GetEntry <SpawnSourceInfo>(TemplateArgsName.SpawnSource); if (source.Source != SpawnSource.Dungeon_System) { return; } naturalBornMonstersThatAreNotEnvironment.Add(uniqueId); }
public int ShowMonsterCountThatAreNotEnvironmentOfCurrentStage(ConfigManager configManager) { if (activeStage == null) { return(0); } int count = 0; List <SsarTuple <CharacterId, int> > monsterIdAndSpawnCount = activeStage.ShowMonsterIdAndSpawnCount(); HeroAndMonsterConfig heroAndMonsterConfig = configManager.GetConfig <HeroAndMonsterConfig>(); for (int i = 0; i < monsterIdAndSpawnCount.Count; i++) { CharacterId characterId = monsterIdAndSpawnCount[i].Element1; HeroConfig.BasicStats basicStats = heroAndMonsterConfig.FindBasicStats(characterId); if (basicStats.ShowRole() == EntityRole.Environment) { continue; } count += monsterIdAndSpawnCount[i].Element2; } return(count); }
public static void ReadCharacterIdsFromFolderStructure(MonsterConfig monsterConfig) { characterIds = new List <string>(); characterIdsLabels = new List <string>(); filterCharacterIds = new List <string>(); filterCharacterIdsLabels = new List <string>(); string path = Application.dataPath + "/" + ResourcesFile.RESOURCES + "/" + "Characters"; List <CharacterId> characterIdsFromFolder = new List <CharacterId>(); foreach (string groupPath in Directory.GetDirectories(path)) { string groupDirName = Path.GetFileName(groupPath); string[] split = groupDirName.Split('_'); if (split.Length < 2) { continue; } string groupId = split[1]; foreach (string subPath in Directory.GetDirectories(groupPath)) { string subDirName = Path.GetFileName(subPath); try { int v = Convert.ToInt32(subDirName); } catch (Exception e) { continue; } string subId = subDirName; string cid = string.Format("{0}_{1}", groupId, subId); characterIdsFromFolder.Add(new CharacterId(cid)); } } characterIdsFromFolder.Sort((id1, id2) => { return(id1.GroupId.CompareTo(id2.GroupId)); }); Dictionary <int, string> groupNameByGroupId = new Dictionary <int, string>(); foreach (CharacterId cid in characterIdsFromFolder) { if (monsterConfig != null) { HeroConfig.BasicStats bs = null; bool found = monsterConfig.FindBasicStats(cid, out bs); if (found) { if (!groupNameByGroupId.ContainsKey(cid.GroupId)) { groupNameByGroupId[cid.GroupId] = bs.name; } characterIdsLabels.Add(cid.GroupId + " - " + groupNameByGroupId[cid.GroupId] + "/" + cid + " - " + bs.name); } else { characterIdsLabels.Add(cid.StringValue); } } characterIds.Add(cid.StringValue); } filterCharacterIds.Add(string.Empty); filterCharacterIds.AddRange(characterIds); filterCharacterIdsLabels.Add("None"); filterCharacterIdsLabels.AddRange(characterIdsLabels); }