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; } public IActivity NextActivity { get; set; }
bool isDone;
bool isDocking; bool isDocking;
Actor refinery; Actor refinery;
@@ -61,12 +60,7 @@ namespace OpenRa.Traits.Activities
isDocking = true; isDocking = true;
refinery.traits.Get<IAcceptOre>().OnDock(self, this); 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; return this;
} }

View File

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

View File

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