Esempio n. 1
0
    public void TakeDamage(int amount, Vector3 hitPoint)
    {
        if (isDead)
        {
            return;
        }
        if (ranged && (enemyRangedMovement.GetAggro() == false))
        {
            enemyRangedMovement.SetAggro(true);
        }
        else if (enemyMovement.GetAggro() == false)
        {
            enemyMovement.SetAggro(true);
        }
        enemyAudio.Play();

        currentHealth -= amount;

        SetHealthUI();          // new

        hitParticles.transform.position = hitPoint;
        hitParticles.Play();

        if (currentHealth <= 0)
        {
            Death();
        }
    }
Esempio n. 2
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject == player)
     {
         if (!movement.GetAggro())
         {
             movement.SetAggro(true);
             foreach (EnemyMovement friend in friends)
             {
                 if (!friend.GetAggro())
                 {
                     friend.SetAggro(true);
                 }
             }
         }
         movement.setPlayerInRange(true);
     }
 }