Create INotifyDamageStateChanged for nearly everything else that used INotifyDamage.

This commit is contained in:
Paul Chote
2011-04-16 11:48:28 +12:00
parent 8b00e1cfa5
commit 794dcac4d2
10 changed files with 35 additions and 46 deletions

View File

@@ -90,7 +90,6 @@ namespace OpenRA.Traits
Damage = damage,
DamageState = this.DamageState,
PreviousDamageState = oldState,
DamageStateChanged = this.DamageState != oldState,
Warhead = warhead,
};
@@ -98,6 +97,11 @@ namespace OpenRA.Traits
.Concat(self.Owner.PlayerActor.TraitsImplementing<INotifyDamage>()))
nd.Damaged(self, ai);
if (DamageState != oldState)
foreach (var nd in self.TraitsImplementing<INotifyDamageStateChanged>())
nd.DamageStateChanged(self, ai);
if (attacker != null && attacker.IsInWorld && !attacker.IsDead())
foreach (var nd in attacker.TraitsImplementing<INotifyAppliedDamage>()
.Concat(attacker.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))