add IHasLocation

This commit is contained in:
Bob
2010-10-08 19:10:31 +13:00
committed by Chris Forbes
parent 9c362f7d41
commit 011a20e8b4
31 changed files with 133 additions and 107 deletions

View File

@@ -82,6 +82,13 @@ namespace OpenRA.Mods.RA
public int2 TopLeft { get { return Location; } }
public IEnumerable<int2> OccupiedCells() { return new int2[] { Location }; }
public int2 PxPosition { get; private set; }
public void SetPxPosition( Actor self, int2 px )
{
SetPosition( self, Util.CellContaining( px ) );
}
public bool CanEnterCell(int2 cell)
{
if (!self.World.Map.IsInMap(cell.X, cell.Y)) return false;
@@ -96,7 +103,7 @@ namespace OpenRA.Mods.RA
uim.Remove(self, this);
Location = cell;
self.CenterLocation = Util.CenterOfCell(cell);
PxPosition = Util.CenterOfCell(cell);
var seq = self.World.GetTerrainInfo(cell).IsWater ? "water" : "idle";
if (seq != self.Trait<RenderSimple>().anim.CurrentSequence.Name)