Add conversions and helpers for world coordinates.
This commit is contained in:
@@ -28,6 +28,8 @@ namespace OpenRA
|
||||
Lazy<IOccupySpace> occupySpace;
|
||||
IHasLocation HasLocation;
|
||||
Lazy<IMove> Move;
|
||||
Lazy<IFacing> Facing;
|
||||
|
||||
public Cached<Rectangle> Bounds;
|
||||
public Cached<Rectangle> ExtendedBounds;
|
||||
|
||||
@@ -44,7 +46,26 @@ namespace OpenRA
|
||||
return HasLocation.PxPosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public WPos CenterPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
var altitude = Move.Value != null ? Move.Value.Altitude : 0;
|
||||
return CenterLocation.ToWPos(altitude);
|
||||
}
|
||||
}
|
||||
|
||||
public WRot Orientation
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO: Support non-zero pitch/roll in IFacing (IOrientation?)
|
||||
var facing = Facing.Value != null ? Facing.Value.Facing : 0;
|
||||
return new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(facing));
|
||||
}
|
||||
}
|
||||
|
||||
public Shroud.ActorVisibility Sight;
|
||||
|
||||
[Sync] public Player Owner;
|
||||
@@ -74,6 +95,7 @@ namespace OpenRA
|
||||
}
|
||||
|
||||
Move = Lazy.New(() => TraitOrDefault<IMove>());
|
||||
Facing = Lazy.New(() => TraitOrDefault<IFacing>());
|
||||
|
||||
Size = Lazy.New(() =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user