public SpawnCharacter(SpawnCharacterAction config, EntitySpawner entitySpawner, Character caster, TemplateArgs args, Environment environment, SkillId skillId, HeroAndMonsterConfig hamc) { this.config = config; this.entitySpawner = entitySpawner; this.caster = caster; this.args = args; this.environment = environment; this.skillId = skillId; this.hamc = hamc; entityGroupOfCaster = caster.GameObject().GetComponent <EntityReference>().Entity.Group; FrameAndSecondsConverter fasc = FrameAndSecondsConverter._30Fps; spawnDelay = fasc.FramesToSeconds(config.delay); vfxDelay = fasc.FramesToSeconds(config.vfxDelay); defaultEntityGroupOfMinion = hamc.FindBasicStats(new CharacterId(config.groupId, config.subId)).team; if (config.spawnCount > 0) { Vector3 spawnPosition = CalculateSpawnPosition(); spawnPositions.Add(spawnPosition); if (spawnDelay <= 0) { Spawn(spawnPosition); } if (vfxDelay <= 0) { PlayVfx(spawnPosition); } } }
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 SkillLoopableElementFactory(Environment environment, ModifierInfoFactory modifierInfoFactory, EntitySpawner entitySpawner, HeroAndMonsterConfig hamc) { this.environment = environment; this.modifierInfoFactory = modifierInfoFactory; this.entitySpawner = entitySpawner; this.hamc = hamc; }
public DungeonFactory(DungeonConfig dungeonConfig, EntitySpawner entitySpawner, CharacterId heroId, List <SsarTuple <int, GameObject> > gateAndId, DamageSystem damageSystem, PromiseWorld world, ConfigManager configManager) { notNullReference.Check(dungeonConfig, "dungeonConfig"); notNullReference.Check(entitySpawner, "entitySpawner"); notNullReference.Check(heroId, "heroId"); notNullReference.Check(gateAndId, "gateAndId"); notNullReference.Check(damageSystem, "damageSystem"); notNullReference.Check(configManager, "configManager"); heroAndMonsterConfig = configManager.GetConfig <HeroAndMonsterConfig>(); defaultEnvironment = new DefaultDungeonEnvironment(entitySpawner, gateAndId); this.dungeonConfig = dungeonConfig; world.EntityCreationEventHandler += (sender, arg) => { Entity entity = arg.Entity; if (arg.EntityType != EntityType.Creature) { return; } if (entity.GetComponent <SkillComponent>().CharacterId.Equals(heroId)) { defaultEnvironment.SetHero(new DefaultDungeonCharacter(entity, damageSystem)); } }; damageSystem.EntityDeathEventHandler_Late += (sender, args) => { CacheTemplateArgsComponent argsComponent = args.Entity.GetComponent <CacheTemplateArgsComponent>(); SpawnSourceInfo source = argsComponent?.TemplateArgs.GetEntry <SpawnSourceInfo>(TemplateArgsName.SpawnSource) ?? new DungeonSystemSpawnSourceInfo(); EntityRole role = args.Entity.GetComponent <StatsComponent>().BasicStatsFromConfig.ShowRole(); defaultEnvironment.AddDeadMonster(new EntityMonster(Time.timeSinceLevelLoad, args.Entity.GetComponent <SkillComponent>().CharacterId, args.Entity.UniqueId, source, role)); }; entitySpawner.EntitySpawnEventHandler += (sender, args) => { if (args.Entity.Group == EntityGroup.GROUP_A) { return; } defaultEnvironment.AddSpawnedMonster(args.UniqueId, args.BasicStats, args.Entity); }; }
public void SetHeroAndMonsterConfig(HeroAndMonsterConfig hamc) { this.hamc = hamc; }