Implement INotifyDamageStateChanged explicitly in WithSpriteBody

This commit is contained in:
reaperrr
2016-10-20 21:23:41 +02:00
parent a6b09342bc
commit 7955aeb1c3
4 changed files with 10 additions and 5 deletions

View File

@@ -83,7 +83,7 @@ namespace OpenRA.Mods.Common.Traits.Render
return int2.Lerp(0, DefaultAnimation.CurrentSequence.Length - 1, gate.Position, gate.OpenPosition); return int2.Lerp(0, DefaultAnimation.CurrentSequence.Length - 1, gate.Position, gate.OpenPosition);
} }
public override void DamageStateChanged(Actor self, AttackInfo e) protected override void DamageStateChanged(Actor self)
{ {
UpdateState(self); UpdateState(self);
} }

View File

@@ -117,10 +117,15 @@ namespace OpenRA.Mods.Common.Traits.Render
DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence)); DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence));
} }
public virtual void DamageStateChanged(Actor self, AttackInfo e) protected virtual void DamageStateChanged(Actor self)
{ {
if (DefaultAnimation.CurrentSequence != null) if (DefaultAnimation.CurrentSequence != null)
DefaultAnimation.ReplaceAnim(NormalizeSequence(self, DefaultAnimation.CurrentSequence.Name)); DefaultAnimation.ReplaceAnim(NormalizeSequence(self, DefaultAnimation.CurrentSequence.Name));
} }
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e)
{
DamageStateChanged(self);
}
} }
} }

View File

@@ -54,9 +54,9 @@ namespace OpenRA.Mods.Common.Traits.Render
turreted.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings; turreted.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings;
} }
public override void DamageStateChanged(Actor self, AttackInfo e) protected override void DamageStateChanged(Actor self)
{ {
base.DamageStateChanged(self, e); base.DamageStateChanged(self);
turreted.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings; turreted.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings;
} }
} }

View File

@@ -101,7 +101,7 @@ namespace OpenRA.Mods.Common.Traits.Render
wallInfo = info; wallInfo = info;
} }
public override void DamageStateChanged(Actor self, AttackInfo e) protected override void DamageStateChanged(Actor self)
{ {
DefaultAnimation.PlayFetchIndex(NormalizeSequence(self, Info.Sequence), () => adjacent); DefaultAnimation.PlayFetchIndex(NormalizeSequence(self, Info.Sequence), () => adjacent);
} }