migrating most things to use the Target struct rather than Actor directly.

This commit is contained in:
Chris Forbes
2010-07-05 18:25:10 +12:00
parent 88b705c8ef
commit 5c61c9d3a9
14 changed files with 57 additions and 49 deletions

View File

@@ -161,12 +161,13 @@ namespace OpenRA.Traits
{
Actor actor;
float2 pos;
bool valid;
public static Target FromActor(Actor a) { return new Target { actor = a }; }
public static Target FromPos(float2 p) { return new Target { pos = p }; }
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 bool IsValid { get { return actor == null || actor.IsInWorld; } }
public float2 Location { get { return actor != null ? actor.CenterLocation : pos; } }
public bool IsValid { get { return valid && (actor == null || actor.IsInWorld); } }
public float2 CenterLocation { get { return actor != null ? actor.CenterLocation : pos; } }
public Actor Actor { get { return actor; } }
public bool IsActor { get { return actor != null; } }