IDamageable

The damage source will use this interface to do damage. Here is a simple implementation of this interface.​

public class ExampleDamageable : MonoBehaviour, IDamageable
{
    public int Health = 100;

    public void TakeDamage(DamageResult result)
    {
        Health -= result.damage;
        if (Health <= 0)
        {       
            // Do something on death
        }
    }
}

Last updated