Ejemplo n.º 1
0
        void SpawnNpc(Npc npc, Wave wave, WavePack pack)
        {
            npc.IsSpawned = true;
            npc.InitData();

            npc.transform.parent   = transform;
            npc.name               = npc.Name + " (id: " + wave.PackCount + "/" + wave.NpcSpawnCount + ")";
            npc.transform.position = GameManager.Instance.MapManager.StartTile.GetTopCenter();

            npc.InitVisuals();

            npc.gameObject.SetActive(true);
            npc.SetLevel(CurrentWaveCount);

            wave.SpawnedNpcs.Add(npc);
            npc.SpawnedInWave = wave;

            npc.GetComponentInChildren <Collider>().gameObject.layer = LayerMask.NameToLayer("Npcs");

            var animator = npc.GetComponentInChildren <Animator>();

            if (animator != null)
            {
                animator.Rebind();
            }

            DebugPrintSpawnNpcData(npc);

            OnNpcSpawned?.Invoke(npc);
        }
Ejemplo n.º 2
0
        private WavePack GeneratePack(Rarities packRarity)
        {
            var packNpcRarities = WaveData.PackNpcs[packRarity];
            var wavePack        = new WavePack();

            packNpcRarities.ForEach(npcRarity =>
            {
                wavePack.AddNpc(GenerateNpc(npcRarity));
            });

            return(wavePack);
        }
Ejemplo n.º 3
0
 public void AddPack(WavePack pack)
 {
     _npcs.AddRange(pack._npcs);
 }