Add hit animation
This commit is contained in:
parent
4d817ea88a
commit
c31747bc19
11 changed files with 592 additions and 5 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue