Fix animation continuity regression

This commit is contained in:
Paul Chote
2010-02-01 12:16:55 +13:00
parent d6f0839a1a
commit ae751ace98
4 changed files with 20 additions and 20 deletions

View File

@@ -6,7 +6,6 @@ namespace OpenRa.Traits.Activities
{
public IActivity NextActivity { get; set; }
bool isDone;
bool isDocking;
Actor refinery;
@@ -62,11 +61,6 @@ namespace OpenRa.Traits.Activities
refinery.traits.Get<IAcceptOre>().OnDock(self, this);
}
var renderUnit = self.traits.Get<RenderUnit>();
if( renderUnit.anim.CurrentSequence.Name != "empty" )
renderUnit.PlayCustomAnimation( self, "empty",
() => isDone = true );
return this;
}

View File

@@ -30,9 +30,16 @@ namespace OpenRa.Traits
if (unit.Facing != 64)
harv.QueueActivity(new Turn(64));
// TODO: This should be delayed until the turn order is complete
harv.traits.Get<Harvester>().Deliver(harv, self);
harv.QueueActivity(new Harvest());
harv.QueueActivity( new CallFunc( () => {
var renderUnit = harv.traits.Get<RenderUnit>();
if (renderUnit.anim.CurrentSequence.Name != "empty")
renderUnit.PlayCustomAnimation(harv, "empty", () =>
{
harv.traits.Get<Harvester>().Deliver(harv, self);
harv.QueueActivity(new Harvest());
});
}
));
}
}
}

View File

@@ -27,16 +27,16 @@ namespace OpenRa.Traits
public int2 DeliverOffset { get { return new int2(0, 2); } }
public void OnDock(Actor harv, DeliverOre dockOrder)
{
// Todo: need to be careful about cancellation and multiple harvs
var unit = harv.traits.Get<Unit>();
harv.QueueActivity(new Move(self.Location + DeliverOffset, self));
harv.QueueActivity(new Move(self.Location + new int2(1,1), self));
harv.QueueActivity(new Turn(96));
// TODO: This should be delayed until the turn order is complete
self.traits.Get<RenderBuilding>().PlayCustomAnimThen(self, "active", () => {
harv.traits.Get<Harvester>().Deliver(harv, self);
harv.QueueActivity(new Move(self.Location + DeliverOffset, self));
harv.QueueActivity(new Harvest());
});
harv.QueueActivity( new CallFunc( () =>
self.traits.Get<RenderBuilding>().PlayCustomAnimThen(self, "active", () => {
harv.traits.Get<Harvester>().Deliver(harv, self);
harv.QueueActivity(new Move(self.Location + DeliverOffset, self));
harv.QueueActivity(new Harvest());
})));
}
}
}

View File

@@ -13,7 +13,6 @@
<sequence name="harvest5" start="52" length="4" />
<sequence name="harvest6" start="56" length="4" />
<sequence name="harvest7" start="60" length="4" />
<sequence name="empty" start="16" length="0" />
</unit>
<unit name="bggy">
<sequence name="idle" start="0" length="32" />