void Update()
    {
        timer += Time.deltaTime;

        if (timer >= timeBetweenAttacks && playerInRange && enemyHealth.currentHealth > 0)
        {
            Attack();
        }

        if (playerHealth.IsDead())
        {
            anim.SetTrigger("PlayerDead");
        }
    }
Exemplo n.º 2
0
 void Update()
 {
     if (playerHealth.IsDead())
     {
         anim.SetTrigger("GameOver");
     }
 }
Exemplo n.º 3
0
 void Update()
 {
     if (enemyHealth.currentHealth > 0 && !playerHealth.IsDead())
     {
         nav.SetDestination(player.position);
     }
     else
     {
         nav.enabled = false;
     }
 }
    void Spawn()
    {
        if (playerHealth.IsDead())
        {
            return;
        }

        int spawnPointIndex = Random.Range(0, spawnPoints.Length);
        int enemyIndex      = Random.Range(0, enemies.Length);

        Instantiate(enemies[enemyIndex], spawnPoints[spawnPointIndex].position, spawnPoints[spawnPointIndex].rotation);
    }
Exemplo n.º 5
0
    private void Spawn()
    {
        DespawnCurrent();

        if (playerHealth.IsDead())
        {
            return;
        }

        if (spawnPointIndex == -1)
        {
            spawnPointIndex = Random.Range(0, spawnPoints.Length);
        }
        else
        {
            spawnPointIndex = RandomExcept(0, spawnPoints.Length, spawnPointIndex);
        }

        currentLightZone = Instantiate(lightZone, spawnPoints[spawnPointIndex].position, spawnPoints[spawnPointIndex].rotation);
    }