Fix some minor style issues in Attack*.

This commit is contained in:
Paul Chote
2014-12-14 10:56:35 +13:00
parent ebdb260650
commit eefd7dba2c
2 changed files with 12 additions and 12 deletions

View File

@@ -35,14 +35,15 @@ namespace OpenRA.Mods.RA
public abstract class AttackBase : IIssueOrder, IResolveOrder, IOrderVoice, ISync
{
[Sync] public bool IsAttacking { get; internal set; }
public IEnumerable<Armament> Armaments { get { return GetArmaments(); } }
public IEnumerable<Armament> Armaments { get { return getArmaments(); } }
public readonly AttackBaseInfo Info;
protected Lazy<IFacing> facing;
protected Lazy<Building> building;
protected Lazy<IPositionable> positionable;
protected Func<IEnumerable<Armament>> GetArmaments;
protected Lazy<IPositionable> positionable;
protected Func<IEnumerable<Armament>> getArmaments;
readonly Actor self;
public readonly AttackBaseInfo Info;
public AttackBase(Actor self, AttackBaseInfo info)
{
@@ -52,7 +53,7 @@ namespace OpenRA.Mods.RA
var armaments = Exts.Lazy(() => self.TraitsImplementing<Armament>()
.Where(a => info.Armaments.Contains(a.Info.Name)));
GetArmaments = () => armaments.Value;
getArmaments = () => armaments.Value;
facing = Exts.Lazy(() => self.TraitOrDefault<IFacing>());
building = Exts.Lazy(() => self.TraitOrDefault<Building>());

View File

@@ -29,13 +29,13 @@ namespace OpenRA.Mods.RA
public class AttackGarrisonedInfo : AttackFollowInfo, Requires<CargoInfo>
{
[Desc("Fire port offsets in local coordinates.")]
public readonly WVec[] PortOffsets = {};
public readonly WVec[] PortOffsets = { };
[Desc("Fire port yaw angles.")]
public readonly WAngle[] PortYaws = {};
public readonly WAngle[] PortYaws = { };
[Desc("Fire port yaw cone angle.")]
public readonly WAngle[] PortCones = {};
public readonly WAngle[] PortCones = { };
public readonly string MuzzlePalette = "effect";
@@ -54,7 +54,6 @@ namespace OpenRA.Mods.RA
Dictionary<Actor, IPositionable> paxPos;
Dictionary<Actor, RenderSprites> paxRender;
public AttackGarrisoned(Actor self, AttackGarrisonedInfo info)
: base(self, info)
{
@@ -66,8 +65,7 @@ namespace OpenRA.Mods.RA
paxPos = new Dictionary<Actor, IPositionable>();
paxRender = new Dictionary<Actor, RenderSprites>();
GetArmaments = () => armaments;
getArmaments = () => armaments;
if (info.PortOffsets.Length == 0)
throw new InvalidOperationException("PortOffsets must have at least one entry.");
@@ -110,7 +108,6 @@ namespace OpenRA.Mods.RA
armaments.RemoveAll(a => a.Actor == passenger);
}
FirePort SelectFirePort(Actor self, WAngle targetYaw)
{
// Pick a random port that faces the target
@@ -171,6 +168,7 @@ namespace OpenRA.Mods.RA
muzzles.Add(muzzleFlash);
muzzleAnim.PlayThen(sequence, () => muzzles.Remove(muzzleFlash));
}
foreach (var npa in self.TraitsImplementing<INotifyAttack>())
npa.Attacking(self, target, a, barrel);
}
@@ -179,6 +177,7 @@ namespace OpenRA.Mods.RA
public IEnumerable<IRenderable> Render(Actor self, WorldRenderer wr)
{
var pal = wr.Palette(info.MuzzlePalette);
// Display muzzle flashes
foreach (var m in muzzles)
foreach (var r in m.Render(self, wr, pal, 1f))