Move the creation of the CrushedSequence to WithDeathAnimation

This commit is contained in:
abcdefg30
2016-01-22 13:55:05 +01:00
parent fe5754e2bd
commit a46815e532
2 changed files with 9 additions and 11 deletions

View File

@@ -57,17 +57,6 @@ namespace OpenRA.Mods.Common.Traits
Game.Sound.Play(info.CrushSound, crusher.CenterPosition);
var wda = self.TraitsImplementing<WithDeathAnimation>()
.FirstOrDefault(s => s.Info.CrushedSequence != null);
if (wda != null)
{
var palette = wda.Info.CrushedSequencePalette;
if (wda.Info.CrushedPaletteIsPlayerPalette)
palette += self.Owner.InternalName;
wda.SpawnDeathAnimation(self, wda.Info.CrushedSequence, palette);
}
self.Kill(crusher);
}

View File

@@ -117,6 +117,15 @@ namespace OpenRA.Mods.Common.Traits
void INotifyCrushed.OnCrush(Actor self, Actor crusher, HashSet<string> crushClasses)
{
crushed = true;
if (Info.CrushedSequence == null)
return;
var crushPalette = Info.CrushedSequencePalette;
if (Info.CrushedPaletteIsPlayerPalette)
crushPalette += self.Owner.InternalName;
SpawnDeathAnimation(self, Info.CrushedSequence, crushPalette);
}
void INotifyCrushed.WarnCrush(Actor self, Actor crusher, HashSet<string> crushClasses) { }