add IHasLocation
This commit is contained in:
@@ -63,7 +63,13 @@ namespace OpenRA.Traits
|
||||
|
||||
public interface IVisibilityModifier { bool IsVisible(Actor self, Player byPlayer); }
|
||||
public interface IRadarColorModifier { Color RadarColorOverride(Actor self); }
|
||||
public interface IOccupySpace
|
||||
|
||||
public interface IHasLocation
|
||||
{
|
||||
int2 PxPosition { get; }
|
||||
}
|
||||
|
||||
public interface IOccupySpace : IHasLocation
|
||||
{
|
||||
int2 TopLeft { get; }
|
||||
IEnumerable<int2> OccupiedCells();
|
||||
@@ -97,15 +103,15 @@ namespace OpenRA.Traits
|
||||
public interface IPips { IEnumerable<PipType> GetPips(Actor self); }
|
||||
public interface ITags { IEnumerable<TagType> GetTags(); }
|
||||
|
||||
public interface ITeleportable /* crap name! */
|
||||
public interface ITeleportable : IHasLocation /* crap name! */
|
||||
{
|
||||
bool CanEnterCell(int2 location);
|
||||
void SetPosition(Actor self, int2 cell);
|
||||
void SetPxPosition(Actor self, int2 px);
|
||||
}
|
||||
|
||||
public interface IMove : ITeleportable
|
||||
{
|
||||
float MovementSpeedForCell(Actor self, int2 cell);
|
||||
int Altitude { get; set; }
|
||||
}
|
||||
|
||||
@@ -226,6 +232,7 @@ namespace OpenRA.Traits
|
||||
public static readonly Target None = new Target();
|
||||
|
||||
public bool IsValid { get { return valid && (actor == null || actor.IsInWorld); } }
|
||||
public int2 PxPosition { get { return actor != null ? actor.Trait<IHasLocation>().PxPosition : pos.ToInt2(); } }
|
||||
public float2 CenterLocation { get { return actor != null ? actor.CenterLocation : pos.ToInt2(); } }
|
||||
|
||||
public Actor Actor { get { return actor; } }
|
||||
|
||||
Reference in New Issue
Block a user