RMBO voices on build and kill.

This commit is contained in:
Paul Chote
2011-03-25 19:46:09 +13:00
parent a14968810c
commit ea626d4b39
6 changed files with 68 additions and 15 deletions

View File

@@ -87,20 +87,27 @@ namespace OpenRA.Traits
damage = (int)(damage * modifier);
hp -= damage;
foreach (var nd in self.TraitsImplementing<INotifyDamage>().Concat(self.Owner.PlayerActor.TraitsImplementing<INotifyDamage>()))
nd.Damaged(self, new AttackInfo
{
Attacker = attacker,
Damage = damage,
DamageState = this.DamageState,
PreviousDamageState = oldState,
DamageStateChanged = this.DamageState != oldState,
Warhead = warhead,
PreviousHealth = hp + damage < 0 ? 0 : hp + damage,
Health = hp
});
var ai = new AttackInfo
{
Attacker = attacker,
Damage = damage,
DamageState = this.DamageState,
PreviousDamageState = oldState,
DamageStateChanged = this.DamageState != oldState,
Warhead = warhead,
PreviousHealth = hp + damage < 0 ? 0 : hp + damage,
Health = hp
};
foreach (var nd in self.TraitsImplementing<INotifyDamage>()
.Concat(self.Owner.PlayerActor.TraitsImplementing<INotifyDamage>()))
nd.Damaged(self, ai);
if (attacker != null && attacker.IsInWorld && !attacker.IsDead())
foreach (var nd in attacker.TraitsImplementing<INotifyAppliedDamage>()
.Concat(attacker.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
nd.AppliedDamage(attacker, self, ai);
if (hp <= 0)
{
hp = 0;

View File

@@ -58,6 +58,7 @@ namespace OpenRA.Traits
public interface ICustomUnitOrderGenerator : IOrderGenerator {};
public interface INotifySold { void Selling( Actor self ); void Sold( Actor self ); }
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); }
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
public interface INotifyProduction { void UnitProduced(Actor self, Actor other, int2 exit); }
public interface INotifyCapture { void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner); }