IDamageable
The damage source will use this interface to do damage. Here is a simple implementation of this interface.​
1
public class ExampleDamageable : MonoBehaviour, IDamageable
2
{
3
public int Health = 100;
4
​
5
public void TakeDamage(DamageResult result)
6
{
7
Health -= result.damage;
8
if (Health <= 0)
9
{
10
// Do something on death
11
}
12
}
13
}
Copied!
​
Last modified 7mo ago
Copy link