Fully support unhardcoded sequences in the voxel render traits
This commit is contained in:
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
|
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
|
||||||
{
|
{
|
||||||
var body = init.Actor.TraitInfo<BodyOrientationInfo>();
|
var body = init.Actor.TraitInfo<BodyOrientationInfo>();
|
||||||
var voxel = VoxelProvider.GetVoxel(image, "idle");
|
var voxel = VoxelProvider.GetVoxel(image, Sequence);
|
||||||
yield return new VoxelAnimation(voxel, () => WVec.Zero,
|
yield return new VoxelAnimation(voxel, () => WVec.Zero,
|
||||||
() => new[] { body.QuantizeOrientation(orientation(), facings) },
|
() => new[] { body.QuantizeOrientation(orientation(), facings) },
|
||||||
() => false, () => 0, ShowShadow);
|
() => false, () => 0, ShowShadow);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.TS.Traits.Render
|
|||||||
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
|
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
|
||||||
{
|
{
|
||||||
var body = init.Actor.TraitInfo<BodyOrientationInfo>();
|
var body = init.Actor.TraitInfo<BodyOrientationInfo>();
|
||||||
var voxel = VoxelProvider.GetVoxel(image, "idle");
|
var voxel = VoxelProvider.GetVoxel(image, IdleSequence);
|
||||||
yield return new VoxelAnimation(voxel, () => WVec.Zero,
|
yield return new VoxelAnimation(voxel, () => WVec.Zero,
|
||||||
() => new[] { body.QuantizeOrientation(orientation(), facings) },
|
() => new[] { body.QuantizeOrientation(orientation(), facings) },
|
||||||
() => false, () => 0, ShowShadow);
|
() => false, () => 0, ShowShadow);
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ namespace OpenRA.Mods.TS.Traits.Render
|
|||||||
{
|
{
|
||||||
public class WithVoxelWalkerBodyInfo : ITraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<IMoveInfo>, Requires<IFacingInfo>
|
public class WithVoxelWalkerBodyInfo : ITraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<IMoveInfo>, Requires<IFacingInfo>
|
||||||
{
|
{
|
||||||
|
public readonly string Sequence = "idle";
|
||||||
|
|
||||||
[Desc("The speed of the walker's legs.")]
|
[Desc("The speed of the walker's legs.")]
|
||||||
public readonly int TickRate = 5;
|
public readonly int TickRate = 5;
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@ namespace OpenRA.Mods.TS.Traits.Render
|
|||||||
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(
|
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(
|
||||||
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
|
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
|
||||||
{
|
{
|
||||||
var voxel = VoxelProvider.GetVoxel(image, "idle");
|
var voxel = VoxelProvider.GetVoxel(image, Sequence);
|
||||||
var body = init.Actor.TraitInfo<BodyOrientationInfo>();
|
var body = init.Actor.TraitInfo<BodyOrientationInfo>();
|
||||||
var frame = init.Contains<BodyAnimationFrameInit>() ? init.Get<BodyAnimationFrameInit, uint>() : 0;
|
var frame = init.Contains<BodyAnimationFrameInit>() ? init.Get<BodyAnimationFrameInit, uint>() : 0;
|
||||||
|
|
||||||
@@ -62,7 +64,7 @@ namespace OpenRA.Mods.TS.Traits.Render
|
|||||||
var body = self.Trait<BodyOrientation>();
|
var body = self.Trait<BodyOrientation>();
|
||||||
var rv = self.Trait<RenderVoxels>();
|
var rv = self.Trait<RenderVoxels>();
|
||||||
|
|
||||||
var voxel = VoxelProvider.GetVoxel(rv.Image, "idle");
|
var voxel = VoxelProvider.GetVoxel(rv.Image, info.Sequence);
|
||||||
frames = voxel.Frames;
|
frames = voxel.Frames;
|
||||||
rv.Add(new VoxelAnimation(voxel, () => WVec.Zero,
|
rv.Add(new VoxelAnimation(voxel, () => WVec.Zero,
|
||||||
() => new[] { body.QuantizeOrientation(self, self.Orientation) },
|
() => new[] { body.QuantizeOrientation(self, self.Orientation) },
|
||||||
|
|||||||
Reference in New Issue
Block a user