summaryrefslogtreecommitdiff
path: root/GameCode/LifeSteal.cs
diff options
context:
space:
mode:
Diffstat (limited to 'GameCode/LifeSteal.cs')
-rw-r--r--GameCode/LifeSteal.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/GameCode/LifeSteal.cs b/GameCode/LifeSteal.cs
new file mode 100644
index 0000000..6608cdb
--- /dev/null
+++ b/GameCode/LifeSteal.cs
@@ -0,0 +1,20 @@
+using UnityEngine;
+
+public class LifeSteal : DealtDamageEffect
+{
+ private HealthHandler health;
+
+ public float multiplier;
+
+ public override void DealtDamage(Vector2 damage, bool selfDamage, Player damagedPlayer = null)
+ {
+ if (!selfDamage)
+ {
+ if (!health)
+ {
+ health = GetComponentInParent<HealthHandler>();
+ }
+ health.Heal(damage.magnitude * multiplier);
+ }
+ }
+}