Add hit animation

This commit is contained in:
henriquenakashima 2020-09-25 20:45:12 -04:00
parent 4d817ea88a
commit c31747bc19
11 changed files with 592 additions and 5 deletions

View file

@ -6,6 +6,7 @@ using UnityEngine;
public class BattleParticipant
{
public delegate void BattleParticipantUpdateAction(BattleParticipant participant);
public event BattleParticipantUpdateAction OnHit;
public event BattleParticipantUpdateAction OnDeath;
public event BattleParticipantUpdateAction OnStatusChanged;
@ -50,6 +51,7 @@ public class BattleParticipant
}
damage = Math.Min(this.hp, damage);
this.hp -= damage;
TriggerOnHit();
return damage;
}
@ -94,6 +96,12 @@ public class BattleParticipant
}
}
private void TriggerOnHit() {
if (this.OnHit != null) {
this.OnHit(this);
}
}
private void TriggerOnDeath() {
if (this.OnDeath != null) {
this.OnDeath(this);