Adds support for damage-stage-based sequences to WithSpriteBody and WithTurret

This commit is contained in:
reaperrr
2015-06-19 21:16:39 +02:00
parent e7a64ffec4
commit 248e6b0e18
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));
}
}
}