> For the complete documentation index, see [llms.txt](https://cowsinss-organization.gitbook.io/fps-engine-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cowsinss-organization.gitbook.io/fps-engine-documentation/content/03.-content/03.6-enemies/enemyhealth.md).

# EnemyHealth

Reworked in 1.3 Update

Oriented at enemies only.

Check some examples of EnemyHealth usage:

* [TrainingTarget](/fps-engine-documentation/content/03.-content/03.6-enemies/trainingtarget.md)
* [CircularTargetEnemy](/fps-engine-documentation/content/03.-content/03.6-enemies/circulartargetenemy.md)

### Identity

* <mark style="color:purple;">\_name</mark>: Name of the enemy. This will appear on the killfeed

### Statistics

* <mark style="color:purple;">maxHealth</mark>: initial enemy health
* <mark style="color:purple;">maxShield</mark>: initial enemy shield

{% hint style="warning" %}
If DestroyOnDie is set to false, your object won’t be destroyed once you kill it.
{% endhint %}

* <mark style="color:purple;">destroyOnDie</mark>: When the object dies, decide if it should be destroyed or not.
  * <mark style="color:purple;">deathEffect</mark>

### UI

* <mark style="color:purple;">showUI</mark>: If true, it will display the UI with the shield and health sliders
  * <mark style="color:purple;">healthSlider</mark>: Slider to display the health
  * <mark style="color:purple;">shieldSlider</mark>: Slider to display the shield

{% hint style="info" %}
Click on ***Create Default UI*** to generate and automatically assign Health & Sliders
{% endhint %}

* <mark style="color:purple;">showDamagePopUps</mark>: Enables and disables Damage Pop Ups, which appear on hitting enemies.
  * <mark style="color:purple;">damagePopUp</mark>: Damage Pop Up object, stored at Cowsins/Prefabs/Others
  * <mark style="color:purple;">xVariation</mark>: Horizontal randomness variation

{% hint style="info" %}
Click on ***Assign Default Damage Pop Up*** to automatically add a reference to the default Damage Pop Up in FPS Engine ( Recommended to use )
{% endhint %}

* <mark style="color:purple;">showKillFeed</mark>: If true, it will display the KillFeed UI on eliminating an enemy
* <mark style="color:purple;">events</mark>

### Functions and Accessors | EnemyHealth.cs&#x20;

> <mark style="color:orange;">isDead ( bool ) / Protected  ( only accessible from scripts that inherit from Interactable.cs )</mark>
>
> Returns true if the enemy is dead

> <mark style="color:orange;">Player ( Transform )</mark>
>
> Returns the player transform.

> <mark style="color:orange;">health ( float ) / ReadOnly</mark>
>
> Returns the current health of the enemy.

> <mark style="color:orange;">shield ( float) / ReadOnly</mark>
>
> Returns the current shield of the enemy.

> <mark style="color:green;">Start() / virtual function</mark>

> <mark style="color:green;">Update() / virtual function</mark>

> <mark style="color:green;">Damage(float \_damage, bool isHeadshot) /  virtual function</mark>
>
> Damage the enemy.
>
> * damage: Damage to apply on damageable´s health.
> * isHeadshot: Whether the shot landed on critical areas or not.&#x20;

> <mark style="color:green;">Die() /  virtual function</mark>
