Use MakeAnimation activity for make animations

This commit is contained in:
Paul Chote
2011-04-10 11:27:57 +12:00
parent 394ee0dfe6
commit a31ef3d8e2
2 changed files with 12 additions and 5 deletions

View File

@@ -15,6 +15,7 @@ using OpenRA.Graphics;
using OpenRA.Mods.RA.Buildings;
using OpenRA.Mods.RA.Effects;
using OpenRA.Traits;
using OpenRA.Mods.RA.Activities;
namespace OpenRA.Mods.RA.Render
{
@@ -58,10 +59,17 @@ namespace OpenRA.Mods.RA.Render
: base(init.self, baseFacing)
{
var self = init.self;
if( init.Contains<SkipMakeAnimsInit>() || !self.Info.Traits.Get<RenderBuildingInfo>().HasMakeAnimation )
anim.PlayThen( "idle", () => self.World.AddFrameEndTask( _ => Complete( self ) ) );
// Work around a bogus crash
anim.PlayRepeating( NormalizeSequence(self, "idle") );
if (self.Info.Traits.Get<RenderBuildingInfo>().HasMakeAnimation && !init.Contains<SkipMakeAnimsInit>())
{
self.QueueActivity(new MakeAnimation(self));
self.QueueActivity(new CallFunc(() => self.World.AddFrameEndTask( _ => Complete( self ) )));
}
else
anim.PlayThen( "make", () => self.World.AddFrameEndTask( _ => Complete( self ) ) );
Complete( self );
}
void Complete( Actor self )