Remove FootprintUtils
This commit is contained in:
@@ -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() { }
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
anim.PlayFetchIndex(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence), () => 0);
|
||||
|
||||
var bi = init.Actor.TraitInfo<BuildingInfo>();
|
||||
var offset = FootprintUtils.CenterOffset(init.World, bi).Y + 512; // Additional 512 units move from center -> top of cell
|
||||
var offset = bi.CenterOffset(init.World).Y + 512; // Additional 512 units move from center -> top of cell
|
||||
yield return new SpriteActorPreview(anim, () => WVec.Zero, () => offset, p, rs.Scale);
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
|
||||
var buildingInfo = self.Info.TraitInfo<BuildingInfo>();
|
||||
|
||||
var offset = FootprintUtils.CenterOffset(self.World, buildingInfo).Y + 512;
|
||||
var offset = buildingInfo.CenterOffset(self.World).Y + 512;
|
||||
renderSprites.Add(new AnimationWithOffset(door, null, () => !buildComplete, offset));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user