示例#1
0
        public void SpawnSingleNpcForCurrentWave(Npc npc, Vector3 position, Tile target)
        {
            var wave = CurrentSpawnedWave;

            npc.IsSpawned = true;
            npc.InitData();

            npc.transform.parent   = transform;
            npc.name               = npc.Name + " (id: " + wave.PackCount + "/" + wave.NpcSpawnCount + ")";
            npc.transform.position = position;
            npc.Target             = target;

            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);
        }
示例#2
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);
        }