Remove FootprintUtils

This commit is contained in:
reaperrr
2017-07-01 17:44:24 +02:00
committed by abcdefg30
parent 46dc827d46
commit fdb3866238
18 changed files with 35 additions and 83 deletions

View File

@@ -47,28 +47,28 @@ namespace OpenRA.Mods.Common.Traits.Render
class WithGateSpriteBody : WithSpriteBody, INotifyRemovedFromWorld, IWallConnector, ITick
{
readonly WithGateSpriteBodyInfo gateInfo;
readonly WithGateSpriteBodyInfo gateBodyInfo;
readonly Gate gate;
bool renderOpen;
public WithGateSpriteBody(ActorInitializer init, WithGateSpriteBodyInfo info)
: base(init, info, () => 0)
{
gateInfo = info;
gateBodyInfo = info;
gate = init.Self.Trait<Gate>();
}
void UpdateState(Actor self)
{
if (renderOpen)
DefaultAnimation.PlayRepeating(NormalizeSequence(self, gateInfo.OpenSequence));
DefaultAnimation.PlayRepeating(NormalizeSequence(self, gateBodyInfo.OpenSequence));
else
DefaultAnimation.PlayFetchIndex(NormalizeSequence(self, Info.Sequence), GetGateFrame);
}
void ITick.Tick(Actor self)
{
if (gateInfo.OpenSequence == null)
if (gateBodyInfo.OpenSequence == null)
return;
if (gate.Position == gate.OpenPosition ^ renderOpen)
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.Common.Traits.Render
void UpdateNeighbours(Actor self)
{
var footprint = FootprintUtils.Tiles(self).ToArray();
var footprint = gate.Info.Tiles(self.Location).ToArray();
var adjacent = Util.ExpandFootprint(footprint, true).Except(footprint)
.Where(self.World.Map.Contains).ToList();
@@ -115,7 +115,7 @@ namespace OpenRA.Mods.Common.Traits.Render
bool IWallConnector.AdjacentWallCanConnect(Actor self, CPos wallLocation, string wallType, out CVec facing)
{
facing = wallLocation - self.Location;
return wallType == gateInfo.Type && gateInfo.WallConnections.Contains(facing);
return wallType == gateBodyInfo.Type && gateBodyInfo.WallConnections.Contains(facing);
}
void IWallConnector.SetDirty() { }