Exemplo n.º 1
0
 private void OnTriggerExit2D(Collider2D other)
 {
     if (other.CompareTag(GameProperties.tagBoundary))
     {
         health = 0;
         EnemyManager.amountEnemies--;
         Murdered?.Invoke(this);
         gameObject.SetActive(false);
     }
 }
Exemplo n.º 2
0
    public void TakeDamage(float damage)
    {
        health -= damage;

        if (health <= 0)
        {
            Murdered?.Invoke();
            gameObject.SetActive(false);
        }
    }
Exemplo n.º 3
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (LayerMask.LayerToName(other.gameObject.layer) == GameProperties.layerPlayer)
     {
         other.GetComponent <PlayerController>().TakeDamage(damageCollision);
         health = 0;
         EnemyManager.amountEnemies--;
         Murdered?.Invoke(this);
         gameObject.SetActive(false);
     }
 }
Exemplo n.º 4
0
    public void TakeDamage(float damage)
    {
        if (health <= 0)
        {
            return;
        }

        health -= damage;

        if (health <= 0)
        {
            EnemyManager.amountEnemies--;
            Murdered?.Invoke(this);
            gameObject.SetActive(false);
        }
    }