more of attack-ground (order wiring, etc); doesn't work.

This commit is contained in:
Chris Forbes
2010-07-07 20:46:19 +12:00
parent 5c61c9d3a9
commit 73b6eb568b
12 changed files with 62 additions and 41 deletions

View File

@@ -70,6 +70,16 @@ namespace OpenRA.Traits.Activities
this.nearEnough = range;
}
public Move(Target target, int range)
: this()
{
this.getPath = self => self.World.PathFinder.FindUnitPathToRange(
self.Location, Util.CellContaining(target.CenterLocation),
range, self);
this.destination = null;
this.nearEnough = range;
}
public Move(Func<List<int2>> getPath)
: this()
{

View File

@@ -165,6 +165,9 @@ namespace OpenRA.Traits
public static Target FromActor(Actor a) { return new Target { actor = a, valid = true }; }
public static Target FromPos(float2 p) { return new Target { pos = p, valid = true }; }
public static Target FromOrder(Order o) { return o.TargetActor != null ? Target.FromActor(o.TargetActor) : Target.FromPos(o.TargetLocation); }
public static readonly Target None = new Target();
public bool IsValid { get { return valid && (actor == null || actor.IsInWorld); } }
public float2 CenterLocation { get { return actor != null ? actor.CenterLocation : pos; } }