private void OnTriggerExit2D(Collider2D other) { if (other.CompareTag(GameProperties.tagBoundary)) { health = 0; EnemyManager.amountEnemies--; Murdered?.Invoke(this); gameObject.SetActive(false); } }
public void TakeDamage(float damage) { health -= damage; if (health <= 0) { Murdered?.Invoke(); gameObject.SetActive(false); } }
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); } }
public void TakeDamage(float damage) { if (health <= 0) { return; } health -= damage; if (health <= 0) { EnemyManager.amountEnemies--; Murdered?.Invoke(this); gameObject.SetActive(false); } }