Exemplo n.º 1
0
    void Update()
    {
        // Add the time since Update was last called to the timer.
        timer += Time.deltaTime;

        // If the timer exceeds the time between attacks, the player is in range and this enemy is alive...
        if (timer >= timeBetweenAttacks && playerInRange && enemyHealth.currentHealth > 0)
        {
            // ... attack.
            Attack();
        }

        // If the player has zero or less health...
        if (playerHealth.currentHealth <= 0)
        {
            // ... tell the animator the player is dead.
            enemyAnim.SetStopped(true);
        }
    }
Exemplo n.º 2
0
 void Update()
 {
     enemyAnim.SetStopped(isStopped);
     enemyFollow.SetStopped(isStopped);
 }