Support multiple WithDeathAnimation traits
This commit is contained in:
@@ -49,7 +49,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public void OnCrush(Actor crusher)
|
public void OnCrush(Actor crusher)
|
||||||
{
|
{
|
||||||
Sound.Play(info.CrushSound, crusher.CenterPosition);
|
Sound.Play(info.CrushSound, crusher.CenterPosition);
|
||||||
var wda = self.TraitOrDefault<WithDeathAnimation>();
|
var wda = self.TraitsImplementing<WithDeathAnimation>()
|
||||||
|
.FirstOrDefault(s => s.Info.CrushedSequence != null);
|
||||||
if (wda != null)
|
if (wda != null)
|
||||||
{
|
{
|
||||||
var palette = wda.Info.CrushedSequencePalette;
|
var palette = wda.Info.CrushedSequencePalette;
|
||||||
|
|||||||
@@ -82,8 +82,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var warhead = e.Warhead as DamageWarhead;
|
var warhead = e.Warhead as DamageWarhead;
|
||||||
var damageType = warhead.DamageTypes.Intersect(Info.DeathTypes.Keys).FirstOrDefault();
|
var damageType = warhead.DamageTypes.Intersect(Info.DeathTypes.Keys).FirstOrDefault();
|
||||||
if (damageType == null)
|
if (damageType == null)
|
||||||
throw new Exception("Actor type `{0}` does not define a death animation for weapon with damage types `{1}`!"
|
return;
|
||||||
.F(self.Info.Name, string.Join(", ", warhead.DamageTypes)));
|
|
||||||
|
|
||||||
sequence += Info.DeathTypes[damageType];
|
sequence += Info.DeathTypes[damageType];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user