Remove the AttackSwallow Info field overloading.

This commit is contained in:
Paul Chote
2014-12-14 10:49:35 +13:00
parent 8e001663dc
commit a50ccd1020
2 changed files with 6 additions and 9 deletions

View File

@@ -28,13 +28,8 @@ namespace OpenRA.Mods.D2k
class AttackSwallow : AttackFrontal class AttackSwallow : AttackFrontal
{ {
new public readonly AttackSwallowInfo Info;
public AttackSwallow(Actor self, AttackSwallowInfo info) public AttackSwallow(Actor self, AttackSwallowInfo info)
: base(self, info) : base(self, info) { }
{
Info = info;
}
public override void DoAttack(Actor self, Target target) public override void DoAttack(Actor self, Target target)
{ {

View File

@@ -30,6 +30,7 @@ namespace OpenRA.Mods.D2k
readonly RenderUnit renderUnit; readonly RenderUnit renderUnit;
readonly RadarPings radarPings; readonly RadarPings radarPings;
readonly AttackSwallow swallow; readonly AttackSwallow swallow;
readonly AttackSwallowInfo swallowInfo;
readonly IPositionable positionable; readonly IPositionable positionable;
int countdown; int countdown;
@@ -41,9 +42,10 @@ namespace OpenRA.Mods.D2k
this.weapon = weapon; this.weapon = weapon;
positionable = self.Trait<Mobile>(); positionable = self.Trait<Mobile>();
swallow = self.Trait<AttackSwallow>(); swallow = self.Trait<AttackSwallow>();
swallowInfo = (AttackSwallowInfo)swallow.Info;
renderUnit = self.Trait<RenderUnit>(); renderUnit = self.Trait<RenderUnit>();
radarPings = self.World.WorldActor.TraitOrDefault<RadarPings>(); radarPings = self.World.WorldActor.TraitOrDefault<RadarPings>();
countdown = swallow.Info.AttackTime; countdown = swallowInfo.AttackTime;
renderUnit.DefaultAnimation.ReplaceAnim("burrowed"); renderUnit.DefaultAnimation.ReplaceAnim("burrowed");
stance = AttackState.Burrowed; stance = AttackState.Burrowed;
@@ -86,7 +88,7 @@ namespace OpenRA.Mods.D2k
void NotifyPlayer(Player player, WPos location) void NotifyPlayer(Player player, WPos location)
{ {
Sound.PlayNotification(player.World.Map.Rules, player, "Speech", swallow.Info.WormAttackNotification, player.Country.Race); Sound.PlayNotification(player.World.Map.Rules, player, "Speech", swallowInfo.WormAttackNotification, player.Country.Race);
radarPings.Add(() => true, location, Color.Red, 50); radarPings.Add(() => true, location, Color.Red, 50);
} }
@@ -128,7 +130,7 @@ namespace OpenRA.Mods.D2k
return NextActivity; return NextActivity;
} }
countdown = swallow.Info.ReturnTime; countdown = swallowInfo.ReturnTime;
stance = AttackState.ReturningUnderground; stance = AttackState.ReturningUnderground;
} }