Exemplo n.º 1
0
        private IEnumerator AllowCameraFollowCoroutine()
        {
            while (IsEnemyAlive())
            {
                yield return(new WaitForSeconds(1f));
            }

            CameraUtils.EnableFollow(true);
        }
Exemplo n.º 2
0
        public void Spawn()
        {
            if (singleEnemyPrefab != null)
            {
                if (enemy == null)
                {
                    InstantiateSingleEnemyPrefab();
                }

                enemy.SetActive(true);
                enemy.transform.position = transform.position;
            }
            else if (enemyPool != null)
            {
                enemy = enemyPool.GetPooledObject();
                enemy.transform.position = transform.position;
            }

            enemyHealthManager = enemy.GetComponentInChildren <HealthManager>();

            if (spawnerType == SpawnerType.Manual && spawnAgainAtDeath)
            {
                spawnCoroutine = StartCoroutine(RespawnUponDeathCoroutine());
            }

            if (spawnerType == SpawnerType.CameraBlocker)
            {
                CameraUtils.EnableFollow(false);
                StartCoroutine(AllowCameraFollowCoroutine());
            }

            if (posToGoAtSpawn != null)
            {
                StartCoroutine(GoToCoroutine(posToGoAtSpawn.position.x));
            }
        }