Clean up HarvesterDockSequence.

This commit is contained in:
Paul Chote
2013-07-21 09:55:38 +12:00
parent 031c17ab9c
commit 8a988e5e02

View File

@@ -20,7 +20,8 @@ namespace OpenRA.Mods.Cnc
{ {
public class HarvesterDockSequence : Activity public class HarvesterDockSequence : Activity
{ {
enum State { Wait, Turn, DragIn, Dock, Loop, Undock, DragOut }; enum State { Wait, Turn, DragIn, Dock, Loop, Undock, DragOut }
static readonly WVec DockOffset = new WVec(-640, 341, 0);
readonly Actor proc; readonly Actor proc;
readonly Harvester harv; readonly Harvester harv;
@@ -34,8 +35,8 @@ namespace OpenRA.Mods.Cnc
state = State.Turn; state = State.Turn;
harv = self.Trait<Harvester>(); harv = self.Trait<Harvester>();
ru = self.Trait<RenderUnit>(); ru = self.Trait<RenderUnit>();
startDock = self.Trait<IHasLocation>().PxPosition.ToWPos(0); startDock = self.CenterPosition;
endDock = (proc.Trait<IHasLocation>().PxPosition + new PVecInt(-15,8)).ToWPos(0); endDock = proc.CenterPosition + DockOffset;
} }
public override Activity Tick(Actor self) public override Activity Tick(Actor self)
@@ -65,6 +66,7 @@ namespace OpenRA.Mods.Cnc
case State.DragOut: case State.DragOut:
return Util.SequenceActivities(new Drag(endDock, startDock, 12), NextActivity); return Util.SequenceActivities(new Drag(endDock, startDock, 12), NextActivity);
} }
throw new InvalidOperationException("Invalid harvester dock state"); throw new InvalidOperationException("Invalid harvester dock state");
} }
@@ -79,4 +81,3 @@ namespace OpenRA.Mods.Cnc
} }
} }
} }