Merge pull request #8508 from reaperrr/damaged-sprites

Added support for damage stages to WithSpriteBody and WithTurret
This commit is contained in:
Pavel Penev
2015-06-25 00:35:05 +03:00
2 changed files with 25 additions and 8 deletions

View File

@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits
}
}
public class WithSpriteBody : UpgradableTrait<WithSpriteBodyInfo>, ISpriteBody
public class WithSpriteBody : UpgradableTrait<WithSpriteBodyInfo>, ISpriteBody, INotifyDamageStateChanged
{
public readonly Animation DefaultAnimation;
@@ -94,5 +94,11 @@ namespace OpenRA.Mods.Common.Traits
after();
});
}
public virtual void DamageStateChanged(Actor self, AttackInfo e)
{
if (DefaultAnimation.CurrentSequence != null)
DefaultAnimation.ReplaceAnim(NormalizeSequence(self, DefaultAnimation.CurrentSequence.Name));
}
}
}