Refactor animation classes.

Specify pause function in constructors of Animation if required, and remove the unused pause function from AnimationWithOffset.

Cleanup Animation.cs and reduce code duplication.
This commit is contained in:
RoosterDragon
2015-10-14 22:33:14 +01:00
parent af4667fc68
commit 082ea6ba73
15 changed files with 67 additions and 71 deletions

View File

@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Traits
DefaultAnimation = new Animation(self.World, rs.GetImage(self), () => turreted.TurretFacing);
DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence));
rs.Add(new AnimationWithOffset(
DefaultAnimation, () => BarrelOffset(), () => IsTraitDisabled, () => false, p => RenderUtils.ZOffsetFromCenter(self, p, 0)));
DefaultAnimation, () => BarrelOffset(), () => IsTraitDisabled, p => RenderUtils.ZOffsetFromCenter(self, p, 0)));
// Restrict turret facings to match the sprite
turreted.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings;