Ejemplo n.º 1
0
        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);
                }
            }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public void SetCookies(IEnumerable <string> cookies)
        {
            notNullReference.Check(cookies, "cookies");

            monsterId           = new CharacterId(cookies.ElementAt(0));
            monsterCount        = Convert.ToInt32(cookies.ElementAt(1));
            spawnInterval       = Convert.ToSingle(cookies.ElementAt(2));
            spawnCount          = Convert.ToInt32(cookies.ElementAt(3));
            spawnX              = Convert.ToSingle(cookies.ElementAt(4));
            spawnY              = Convert.ToSingle(cookies.ElementAt(5));
            spawnZ              = Convert.ToSingle(cookies.ElementAt(6));
            xAxisAmplitude      = Convert.ToSingle(cookies.ElementAt(7));
            xAxisDensity        = Convert.ToInt32(cookies.ElementAt(8));
            facingDirection     = (Direction)Enum.Parse(typeof(Direction), cookies.ElementAt(9));
            spawnSkillLevelPool = DungeonSpawnConfig.Spawn.ParseSkillLevelPool(cookies.ElementAt(10));
            monsterLevel        = Convert.ToInt32(cookies.ElementAt(11));

            elapsedTimeSinceLastSpawn = spawnInterval;

            monsterCountSoFar      = monsterCount * spawnCount;
            monsterIdAndSpawnCount = new SsarTuple <CharacterId, int>(monsterId, monsterCountSoFar);

            group = hamc.FindBasicStats(monsterId).team;
        }