Remove IHasLocation lookup from Target.

This commit is contained in:
Paul Chote
2013-07-21 10:03:48 +12:00
parent 200fde77b1
commit ac3f63b59c

View File

@@ -45,8 +45,7 @@ namespace OpenRA.Traits
} }
public bool IsValid { get { return valid && (actor == null || (actor.IsInWorld && !actor.IsDead() && actor.Generation == generation)); } } public bool IsValid { get { return valid && (actor == null || (actor.IsInWorld && !actor.IsDead() && actor.Generation == generation)); } }
public PPos PxPosition { get { return IsActor ? actor.Trait<IHasLocation>().PxPosition : PPos.FromWPos(pos); } } public PPos CenterLocation { get { return IsActor ? actor.CenterLocation : PPos.FromWPos(pos); } }
public PPos CenterLocation { get { return PxPosition; } }
public Actor Actor { get { return IsActor ? actor : null; } } public Actor Actor { get { return IsActor ? actor : null; } }
// TODO: This should return true even if the actor is destroyed // TODO: This should return true even if the actor is destroyed