Simplify Fly interface.

This commit is contained in:
Paul Chote
2014-01-16 22:32:08 +13:00
parent c781d4c2fe
commit 4eaaa052cc
11 changed files with 29 additions and 24 deletions

View File

@@ -16,8 +16,13 @@ namespace OpenRA.Mods.RA.Air
public class Fly : Activity
{
readonly WPos pos;
readonly Plane plane;
Fly(WPos pos) { this.pos = pos; }
public Fly(Actor self, Target t)
{
plane = self.Trait<Plane>();
pos = t.CenterPosition;
}
public static void FlyToward(Actor self, Plane plane, int desiredFacing, WRange desiredAltitude)
{
@@ -36,9 +41,6 @@ namespace OpenRA.Mods.RA.Air
plane.SetPosition(self, plane.CenterPosition + move);
}
public static Fly ToPos(WPos pos) { return new Fly(pos); }
public static Fly ToCell(CPos pos) { return new Fly(pos.CenterPosition); }
public override Activity Tick(Actor self)
{
if (IsCanceled)
@@ -49,7 +51,6 @@ namespace OpenRA.Mods.RA.Air
if (d.HorizontalLengthSquared < 91022)
return NextActivity;
var plane = self.Trait<Plane>();
var desiredFacing = Util.GetFacing(d, plane.Facing);
// Don't turn until we've reached the cruise altitude