Merge pull request #12062 from abc013/VoxelShadows

Added a flag ShowShadow in WithVoxelBarrel, WithVoxelBody, …
This commit is contained in:
Oliver Brakmann
2016-09-30 16:04:30 +02:00
committed by GitHub
7 changed files with 33 additions and 14 deletions

View File

@@ -28,6 +28,9 @@ namespace OpenRA.Mods.TS.Traits.Render
[Desc("Voxel sequence name to use when undocked from a refinery.")]
public readonly string IdleSequence = "idle";
[Desc("Defines if the Voxel should have a shadow.")]
public readonly bool ShowShadow = true;
public object Create(ActorInitializer init) { return new WithVoxelUnloadBody(init.Self, this); }
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(
@@ -37,7 +40,7 @@ namespace OpenRA.Mods.TS.Traits.Render
var voxel = VoxelProvider.GetVoxel(image, "idle");
yield return new VoxelAnimation(voxel, () => WVec.Zero,
() => new[] { body.QuantizeOrientation(orientation(), facings) },
() => false, () => 0);
() => false, () => 0, ShowShadow);
}
}
@@ -56,7 +59,7 @@ namespace OpenRA.Mods.TS.Traits.Render
rv.Add(new VoxelAnimation(idleVoxel, () => WVec.Zero,
() => new[] { body.QuantizeOrientation(self, self.Orientation) },
() => Docked,
() => 0));
() => 0, info.ShowShadow));
// Selection size
var rvi = self.Info.TraitInfo<RenderVoxelsInfo>();
@@ -67,7 +70,7 @@ namespace OpenRA.Mods.TS.Traits.Render
rv.Add(new VoxelAnimation(unloadVoxel, () => WVec.Zero,
() => new[] { body.QuantizeOrientation(self, self.Orientation) },
() => !Docked,
() => 0));
() => 0, info.ShowShadow));
}
public int2 SelectionSize(Actor self) { return size; }

View File

@@ -24,7 +24,11 @@ namespace OpenRA.Mods.TS.Traits.Render
{
public class WithVoxelWalkerBodyInfo : ITraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<IMoveInfo>, Requires<IFacingInfo>
{
[Desc("The speed of the walker's legs.")]
public readonly int TickRate = 5;
[Desc("Defines if the Voxel should have a shadow.")]
public readonly bool ShowShadow = true;
public object Create(ActorInitializer init) { return new WithVoxelWalkerBody(init.Self, this); }
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(
@@ -36,7 +40,7 @@ namespace OpenRA.Mods.TS.Traits.Render
yield return new VoxelAnimation(voxel, () => WVec.Zero,
() => new[] { body.QuantizeOrientation(orientation(), facings) },
() => false, () => frame);
() => false, () => frame, ShowShadow);
}
}
@@ -62,7 +66,7 @@ namespace OpenRA.Mods.TS.Traits.Render
frames = voxel.Frames;
rv.Add(new VoxelAnimation(voxel, () => WVec.Zero,
() => new[] { body.QuantizeOrientation(self, self.Orientation) },
() => false, () => frame));
() => false, () => frame, info.ShowShadow));
// Selection size
var rvi = self.Info.TraitInfo<RenderVoxelsInfo>();