Move WithSpriteBody pause check to constructor
This commit is contained in:
@@ -59,6 +59,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
() => PlayCustomAnimationRepeating(init.Self, info.Sequence));
|
() => PlayCustomAnimationRepeating(init.Self, info.Sequence));
|
||||||
else
|
else
|
||||||
DefaultAnimation.PlayRepeating(NormalizeSequence(init.Self, info.Sequence));
|
DefaultAnimation.PlayRepeating(NormalizeSequence(init.Self, info.Sequence));
|
||||||
|
|
||||||
|
if (info.PauseAnimationWhenDisabled)
|
||||||
|
DefaultAnimation.Paused = () =>
|
||||||
|
init.Self.IsDisabled() && DefaultAnimation.CurrentSequence.Name == NormalizeSequence(init.Self, Info.Sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string NormalizeSequence(Actor self, string sequence)
|
public string NormalizeSequence(Actor self, string sequence)
|
||||||
@@ -70,10 +74,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public virtual void BuildingComplete(Actor self)
|
public virtual void BuildingComplete(Actor self)
|
||||||
{
|
{
|
||||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence));
|
DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence));
|
||||||
|
|
||||||
if (Info.PauseAnimationWhenDisabled)
|
|
||||||
DefaultAnimation.Paused = () =>
|
|
||||||
self.IsDisabled() && DefaultAnimation.CurrentSequence.Name == NormalizeSequence(self, Info.Sequence);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayCustomAnimation(Actor self, string name, Action after = null)
|
public void PlayCustomAnimation(Actor self, string name, Action after = null)
|
||||||
|
|||||||
Reference in New Issue
Block a user