Fix make animations.

This commit is contained in:
Paul Chote
2014-07-08 16:50:02 +12:00
parent 5650d5fc98
commit 2b91a2363b
5 changed files with 39 additions and 48 deletions

View File

@@ -36,8 +36,6 @@ namespace OpenRA.Mods.RA.Render
public class RenderBuilding : RenderSimple, INotifyDamageStateChanged, INotifyBuildComplete
{
RenderBuildingInfo info;
bool buildComplete;
bool skipMakeAnimation;
public RenderBuilding(ActorInitializer init, RenderBuildingInfo info)
: this(init, info, () => 0) { }
@@ -47,26 +45,12 @@ namespace OpenRA.Mods.RA.Render
{
var self = init.self;
this.info = info;
skipMakeAnimation = init.Contains<SkipMakeAnimsInit>();
DefaultAnimation.Initialize(NormalizeSequence(self, "idle"));
DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle"));
self.Trait<IBodyOrientation>().SetAutodetectedFacings(DefaultAnimation.CurrentSequence.Facings);
}
public override void Tick(Actor self)
{
base.Tick(self);
if (buildComplete)
return;
buildComplete = true;
if (!self.HasTrait<WithMakeAnimation>() || skipMakeAnimation)
foreach (var notify in self.TraitsImplementing<INotifyBuildComplete>())
notify.BuildingComplete(self);
}
public virtual void BuildingComplete(Actor self)
{
DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle"));