Make WithSpriteBody.PlayCustomAnimation resume loop of Sequence
...after it finished playing.
This commit is contained in:
@@ -75,8 +75,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
if (!IsTraitDisabled && !wsb.IsTraitDisabled && !string.IsNullOrEmpty(Info.AttackSequence))
|
||||
{
|
||||
attackAnimPlaying = true;
|
||||
wsb.PlayCustomAnimation(self, Info.AttackSequence,
|
||||
() => { wsb.CancelCustomAnimation(self); attackAnimPlaying = false; });
|
||||
wsb.PlayCustomAnimation(self, Info.AttackSequence, () => attackAnimPlaying = false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
void INotifyBuildingPlaced.BuildingPlaced(Actor self)
|
||||
{
|
||||
if (buildComplete)
|
||||
wsb.PlayCustomAnimation(self, info.Sequence, () => wsb.CancelCustomAnimation(self));
|
||||
wsb.PlayCustomAnimation(self, info.Sequence);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
|
||||
if (--ticks <= 0)
|
||||
{
|
||||
wsb.PlayCustomAnimation(self, Info.Sequences.Random(Game.CosmeticRandom), () => wsb.CancelCustomAnimation(self));
|
||||
wsb.PlayCustomAnimation(self, Info.Sequences.Random(Game.CosmeticRandom));
|
||||
ticks = Info.Interval;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
void INotifyRearm.Rearming(Actor self, Actor target)
|
||||
{
|
||||
if (buildComplete && spriteBody != null && !IsTraitDisabled)
|
||||
spriteBody.PlayCustomAnimation(self, Info.Sequence, () => spriteBody.CancelCustomAnimation(self));
|
||||
spriteBody.PlayCustomAnimation(self, Info.Sequence);
|
||||
}
|
||||
|
||||
void INotifyBuildComplete.BuildingComplete(Actor self)
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
void INotifyRepair.Repairing(Actor self, Actor target)
|
||||
{
|
||||
if (buildComplete && spriteBody != null && !IsTraitDisabled)
|
||||
spriteBody.PlayCustomAnimation(self, Info.Sequence, () => spriteBody.CancelCustomAnimation(self));
|
||||
spriteBody.PlayCustomAnimation(self, Info.Sequence);
|
||||
}
|
||||
|
||||
void INotifyBuildComplete.BuildingComplete(Actor self)
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
{
|
||||
DefaultAnimation.PlayThen(NormalizeSequence(self, name), () =>
|
||||
{
|
||||
DefaultAnimation.Play(NormalizeSequence(self, Info.Sequence));
|
||||
CancelCustomAnimation(self);
|
||||
if (after != null)
|
||||
after();
|
||||
});
|
||||
@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
{
|
||||
DefaultAnimation.PlayBackwardsThen(NormalizeSequence(self, name), () =>
|
||||
{
|
||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence));
|
||||
CancelCustomAnimation(self);
|
||||
if (after != null)
|
||||
after();
|
||||
});
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var wsb = self.TraitOrDefault<WithSpriteBody>();
|
||||
if (wsb != null && wsb.DefaultAnimation.HasSequence(info.Sequence))
|
||||
wsb.PlayCustomAnimation(self, info.Sequence, () => wsb.CancelCustomAnimation(self));
|
||||
wsb.PlayCustomAnimation(self, info.Sequence);
|
||||
|
||||
Game.Sound.Play(SoundType.World, info.OnFireSound, self.World.Map.CenterOfCell(order.TargetLocation));
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!string.IsNullOrEmpty(info.ActivationSequence))
|
||||
{
|
||||
var wsb = self.Trait<WithSpriteBody>();
|
||||
wsb.PlayCustomAnimation(self, info.ActivationSequence, () => wsb.CancelCustomAnimation(self));
|
||||
wsb.PlayCustomAnimation(self, info.ActivationSequence);
|
||||
}
|
||||
|
||||
var targetPosition = self.World.Map.CenterOfCell(order.TargetLocation);
|
||||
|
||||
Reference in New Issue
Block a user