Simplify return statements.

Remove redundant ‘this’.
Remove unused using directives.
Simplify LINQ chains.
Add some trait property descriptions.
Add readonly where viable.
Add fullstops to some yaml descriptions.
This commit is contained in:
Taryn Hill
2015-04-01 11:16:04 -05:00
parent 14e9cfd433
commit 4ed53c5952
54 changed files with 59 additions and 109 deletions

View File

@@ -41,8 +41,8 @@ namespace OpenRA.Mods.TS.Traits
public readonly WAngle LightPitch = WAngle.FromDegrees(50);
public readonly WAngle LightYaw = WAngle.FromDegrees(240);
public readonly float[] LightAmbientColor = new float[] { 0.6f, 0.6f, 0.6f };
public readonly float[] LightDiffuseColor = new float[] { 0.4f, 0.4f, 0.4f };
public readonly float[] LightAmbientColor = { 0.6f, 0.6f, 0.6f };
public readonly float[] LightDiffuseColor = { 0.4f, 0.4f, 0.4f };
public virtual object Create(ActorInitializer init) { return new RenderVoxels(init.Self, this); }
@@ -63,17 +63,17 @@ namespace OpenRA.Mods.TS.Traits
.SelectMany(rvpi => rvpi.RenderPreviewVoxels(init, this, image, orientation, facings, palette))
.ToArray();
yield return new VoxelPreview(components, WVec.Zero, 0, this.Scale, this.LightPitch,
this.LightYaw, this.LightAmbientColor, this.LightDiffuseColor, body.CameraPitch,
yield return new VoxelPreview(components, WVec.Zero, 0, Scale, LightPitch,
LightYaw, LightAmbientColor, LightDiffuseColor, body.CameraPitch,
palette, init.WorldRenderer.Palette(NormalsPalette), init.WorldRenderer.Palette(ShadowPalette));
}
}
public class RenderVoxels : IRender, INotifyOwnerChanged
{
readonly List<VoxelAnimation> components = new List<VoxelAnimation>();
Actor self;
RenderVoxelsInfo info;
List<VoxelAnimation> components = new List<VoxelAnimation>();
IBodyOrientation body;
WRot camera;
WRot lightSource;

View File

@@ -67,7 +67,7 @@ namespace OpenRA.Mods.TS.Traits
var rv = self.Trait<RenderVoxels>();
rv.Add(new VoxelAnimation(VoxelProvider.GetVoxel(rv.Image, info.Sequence),
() => BarrelOffset(), () => BarrelRotation(),
BarrelOffset, BarrelRotation,
() => false, () => 0));
}

View File

@@ -45,9 +45,9 @@ namespace OpenRA.Mods.TS.Traits
public class WithVoxelTurret
{
Actor self;
Turreted turreted;
IBodyOrientation body;
readonly Actor self;
readonly Turreted turreted;
readonly IBodyOrientation body;
public WithVoxelTurret(Actor self, WithVoxelTurretInfo info)
{
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.TS.Traits
var rv = self.Trait<RenderVoxels>();
rv.Add(new VoxelAnimation(VoxelProvider.GetVoxel(rv.Image, info.Sequence),
() => turreted.Position(self), () => TurretRotation(),
() => turreted.Position(self), TurretRotation,
() => false, () => 0));
}