Add methods to IOccupySpaceInfo.

This commit is contained in:
Paul Chote
2015-04-06 14:15:57 +01:00
parent 5754de141d
commit 9e5e1f1a89
8 changed files with 53 additions and 2 deletions

View File

@@ -104,6 +104,16 @@ namespace OpenRA.Mods.Common.Traits
.Any(b => Math.Abs(a.X - b.X) <= Adjacent
&& Math.Abs(a.Y - b.Y) <= Adjacent));
}
public IReadOnlyDictionary<CPos, SubCell> OccupiedCells(ActorInfo info, CPos topLeft, SubCell subCell = SubCell.Any)
{
var occupied = FootprintUtils.UnpathableTiles(info.Name, this, topLeft)
.ToDictionary(c => c, c => SubCell.FullCell);
return new ReadOnlyDictionary<CPos, SubCell>(occupied);
}
bool IOccupySpaceInfo.SharesCell { get { return false; } }
}
public class Building : IOccupySpace, INotifySold, INotifyTransform, ISync, INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld