Support dynamic offsets in ActorPreviews.
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
|
||||||
@@ -17,12 +18,12 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
public class SpriteActorPreview : IActorPreview
|
public class SpriteActorPreview : IActorPreview
|
||||||
{
|
{
|
||||||
readonly Animation animation;
|
readonly Animation animation;
|
||||||
readonly WVec offset;
|
readonly Func<WVec> offset;
|
||||||
readonly int zOffset;
|
readonly Func<int> zOffset;
|
||||||
readonly PaletteReference pr;
|
readonly PaletteReference pr;
|
||||||
readonly float scale;
|
readonly float scale;
|
||||||
|
|
||||||
public SpriteActorPreview(Animation animation, WVec offset, int zOffset, PaletteReference pr, float scale)
|
public SpriteActorPreview(Animation animation, Func<WVec> offset, Func<int> zOffset, PaletteReference pr, float scale)
|
||||||
{
|
{
|
||||||
this.animation = animation;
|
this.animation = animation;
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
@@ -35,7 +36,7 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
|
|
||||||
public IEnumerable<IRenderable> Render(WorldRenderer wr, WPos pos)
|
public IEnumerable<IRenderable> Render(WorldRenderer wr, WPos pos)
|
||||||
{
|
{
|
||||||
return animation.Render(pos, offset, zOffset, pr, scale);
|
return animation.Render(pos, offset(), zOffset(), pr, scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
// Z-order is one set to the top of the footprint
|
// Z-order is one set to the top of the footprint
|
||||||
var offset = map.CenterOfCell(cell) - map.CenterOfCell(location) - centerOffset;
|
var offset = map.CenterOfCell(cell) - map.CenterOfCell(location) - centerOffset;
|
||||||
yield return new SpriteActorPreview(anim, offset, -(offset.Y + centerOffset.Y + 512), p, rs.Scale);
|
yield return new SpriteActorPreview(anim, () => offset, () => -(offset.Y + centerOffset.Y + 512), p, rs.Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
@@ -20,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
public interface IRenderActorPreviewVoxelsInfo : ITraitInfo
|
public interface IRenderActorPreviewVoxelsInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
IEnumerable<VoxelAnimation> RenderPreviewVoxels(
|
IEnumerable<VoxelAnimation> RenderPreviewVoxels(
|
||||||
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, WRot orientation, int facings, PaletteReference p);
|
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RenderVoxelsInfo : ITraitInfo, IRenderActorPreviewInfo, Requires<BodyOrientationInfo>
|
public class RenderVoxelsInfo : ITraitInfo, IRenderActorPreviewInfo, Requires<BodyOrientationInfo>
|
||||||
@@ -62,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
var facing = ifacing != null ? init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : ifacing.GetInitialFacing() : 0;
|
var facing = ifacing != null ? init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : ifacing.GetInitialFacing() : 0;
|
||||||
var orientation = WRot.FromFacing(facing);
|
var orientation = WRot.FromFacing(facing);
|
||||||
var components = init.Actor.TraitInfos<IRenderActorPreviewVoxelsInfo>()
|
var components = init.Actor.TraitInfos<IRenderActorPreviewVoxelsInfo>()
|
||||||
.SelectMany(rvpi => rvpi.RenderPreviewVoxels(init, this, image, orientation, facings, palette))
|
.SelectMany(rvpi => rvpi.RenderPreviewVoxels(init, this, image, () => orientation, facings, palette))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
yield return new VoxelPreview(components, WVec.Zero, 0, Scale, LightPitch,
|
yield return new VoxelPreview(components, WVec.Zero, 0, Scale, LightPitch,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
{
|
{
|
||||||
var anim = new Animation(init.World, rs.Image, () => 0);
|
var anim = new Animation(init.World, rs.Image, () => 0);
|
||||||
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), IdleSequence));
|
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), IdleSequence));
|
||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, () => WVec.Zero, () => 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
var anim = new Animation(init.World, image, () => facing);
|
var anim = new Animation(init.World, image, () => facing);
|
||||||
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
||||||
|
|
||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, () => WVec.Zero, () => 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
var anim = new Animation(init.World, image);
|
var anim = new Animation(init.World, image);
|
||||||
anim.PlayFetchIndex(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence), () => 0);
|
anim.PlayFetchIndex(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence), () => 0);
|
||||||
|
|
||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, () => WVec.Zero, () => 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
string IWallConnectorInfo.GetWallConnectionType()
|
string IWallConnectorInfo.GetWallConnectionType()
|
||||||
|
|||||||
@@ -51,9 +51,10 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
var anim = new Animation(init.World, image, () => facing);
|
var anim = new Animation(init.World, image, () => facing);
|
||||||
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
||||||
|
|
||||||
var orientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(facing)), facings);
|
var orientation = body.QuantizeOrientation(WRot.FromFacing(facing), facings);
|
||||||
var offset = body.LocalToWorld(Offset.Rotate(orientation));
|
var offset = body.LocalToWorld(Offset.Rotate(orientation));
|
||||||
yield return new SpriteActorPreview(anim, offset, offset.Y + offset.Z + 1, p, rs.Scale);
|
var zOffset = offset.Y + offset.Z + 1;
|
||||||
|
yield return new SpriteActorPreview(anim, () => offset, () => zOffset, p, rs.Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
|
|
||||||
var anim = new Animation(init.World, image, () => facing);
|
var anim = new Animation(init.World, image, () => facing);
|
||||||
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), StandSequences.First()));
|
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), StandSequences.First()));
|
||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, () => WVec.Zero, () => 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,9 +73,10 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
|
|
||||||
var body = init.Actor.TraitInfo<BodyOrientationInfo>();
|
var body = init.Actor.TraitInfo<BodyOrientationInfo>();
|
||||||
var facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : 0;
|
var facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : 0;
|
||||||
var orientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(facing)), facings);
|
var orientation = body.QuantizeOrientation(WRot.FromFacing(facing), facings);
|
||||||
var offset = body.LocalToWorld(Offset.Rotate(orientation));
|
var offset = body.LocalToWorld(Offset.Rotate(orientation));
|
||||||
yield return new SpriteActorPreview(anim, offset, offset.Y + offset.Z + 1, p, rs.Scale);
|
var zOffset = offset.Y + offset.Z + 1;
|
||||||
|
yield return new SpriteActorPreview(anim, () => offset, () => zOffset, p, rs.Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
|
|
||||||
var bi = init.Actor.TraitInfo<BuildingInfo>();
|
var bi = init.Actor.TraitInfo<BuildingInfo>();
|
||||||
var offset = FootprintUtils.CenterOffset(init.World, bi).Y + 512; // Additional 512 units move from center -> top of cell
|
var offset = FootprintUtils.CenterOffset(init.World, bi).Y + 512; // Additional 512 units move from center -> top of cell
|
||||||
yield return new SpriteActorPreview(anim, WVec.Zero, offset, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, () => WVec.Zero, () => offset, p, rs.Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
@@ -46,10 +47,15 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
var anim = new Animation(init.World, image, () => t.InitialFacing);
|
var anim = new Animation(init.World, image, () => t.InitialFacing);
|
||||||
anim.Play(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
anim.Play(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
||||||
|
|
||||||
var turretOrientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(t.InitialFacing)), facings);
|
var turretOrientation = body.QuantizeOrientation(WRot.FromFacing(t.InitialFacing), facings);
|
||||||
var turretOffset = body.LocalToWorld(t.Offset.Rotate(turretOrientation));
|
Func<WVec> turretOffset = () => body.LocalToWorld(t.Offset.Rotate(turretOrientation));
|
||||||
|
Func<int> zOffset = () =>
|
||||||
|
{
|
||||||
|
var tmpOffset = turretOffset();
|
||||||
|
return tmpOffset.Y + tmpOffset.Z;
|
||||||
|
};
|
||||||
|
|
||||||
yield return new SpriteActorPreview(anim, turretOffset, turretOffset.Y + turretOffset.Z, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, turretOffset, zOffset, p, rs.Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
var anim = new Animation(init.World, image);
|
var anim = new Animation(init.World, image);
|
||||||
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
||||||
|
|
||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, () => WVec.Zero, () => 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,9 +51,10 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
var anim = new Animation(init.World, image, () => turretFacing);
|
var anim = new Animation(init.World, image, () => turretFacing);
|
||||||
anim.Play(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
anim.Play(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
|
||||||
|
|
||||||
var orientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(bodyFacing)), facings);
|
var orientation = body.QuantizeOrientation(WRot.FromFacing(bodyFacing), facings);
|
||||||
var offset = body.LocalToWorld(t.Offset.Rotate(orientation));
|
var offset = body.LocalToWorld(t.Offset.Rotate(orientation));
|
||||||
yield return new SpriteActorPreview(anim, offset, -(offset.Y + offset.Z) + 1, p, rs.Scale);
|
var zOffset = -(offset.Y + offset.Z) + 1;
|
||||||
|
yield return new SpriteActorPreview(anim, () => offset, () => zOffset, p, rs.Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
var anim = new Animation(init.World, image, () => t.InitialFacing);
|
var anim = new Animation(init.World, image, () => t.InitialFacing);
|
||||||
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), wsb.Sequence));
|
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), wsb.Sequence));
|
||||||
|
|
||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, () => WVec.Zero, () => 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
@@ -30,7 +31,8 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new WithVoxelBarrel(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithVoxelBarrel(init.Self, this); }
|
||||||
|
|
||||||
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, WRot orientation, int facings, PaletteReference p)
|
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(
|
||||||
|
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
|
||||||
{
|
{
|
||||||
if (UpgradeMinEnabledLevel > 0)
|
if (UpgradeMinEnabledLevel > 0)
|
||||||
yield break;
|
yield break;
|
||||||
@@ -44,13 +46,13 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
var voxel = VoxelProvider.GetVoxel(image, Sequence);
|
var voxel = VoxelProvider.GetVoxel(image, Sequence);
|
||||||
|
|
||||||
var turretFacing = Turreted.GetInitialTurretFacing(init, t.InitialFacing, t.Turret);
|
var turretFacing = Turreted.GetInitialTurretFacing(init, t.InitialFacing, t.Turret);
|
||||||
var turretOrientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(turretFacing) - orientation.Yaw), facings);
|
Func<WRot> turretOrientation = () => body.QuantizeOrientation(WRot.FromYaw(WAngle.FromFacing(turretFacing) - orientation().Yaw), facings);
|
||||||
|
|
||||||
var quantizedTurret = body.QuantizeOrientation(turretOrientation, facings);
|
Func<WRot> quantizedTurret = () => body.QuantizeOrientation(turretOrientation(), facings);
|
||||||
var quantizedBody = body.QuantizeOrientation(orientation, facings);
|
Func<WRot> quantizedBody = () => body.QuantizeOrientation(orientation(), facings);
|
||||||
var barrelOffset = body.LocalToWorld((t.Offset + LocalOffset.Rotate(quantizedTurret)).Rotate(quantizedBody));
|
Func<WVec> barrelOffset = () => body.LocalToWorld((t.Offset + LocalOffset.Rotate(quantizedTurret())).Rotate(quantizedBody()));
|
||||||
|
|
||||||
yield return new VoxelAnimation(voxel, () => barrelOffset, () => new[] { turretOrientation, orientation },
|
yield return new VoxelAnimation(voxel, barrelOffset, () => new[] { turretOrientation(), orientation() },
|
||||||
() => false, () => 0);
|
() => false, () => 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new WithVoxelBody(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithVoxelBody(init.Self, this); }
|
||||||
|
|
||||||
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, WRot orientation, int facings, PaletteReference p)
|
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(
|
||||||
|
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, "idle");
|
||||||
var bodyOrientation = new[] { body.QuantizeOrientation(orientation, facings) };
|
|
||||||
yield return new VoxelAnimation(voxel, () => WVec.Zero,
|
yield return new VoxelAnimation(voxel, () => WVec.Zero,
|
||||||
() => bodyOrientation,
|
() => new[] { body.QuantizeOrientation(orientation(), facings) },
|
||||||
() => false, () => 0);
|
() => false, () => 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
@@ -27,7 +28,8 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new WithVoxelTurret(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithVoxelTurret(init.Self, this); }
|
||||||
|
|
||||||
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, WRot orientation, int facings, PaletteReference p)
|
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(
|
||||||
|
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
|
||||||
{
|
{
|
||||||
if (UpgradeMinEnabledLevel > 0)
|
if (UpgradeMinEnabledLevel > 0)
|
||||||
yield break;
|
yield break;
|
||||||
@@ -37,12 +39,12 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
.First(tt => tt.Turret == Turret);
|
.First(tt => tt.Turret == Turret);
|
||||||
|
|
||||||
var voxel = VoxelProvider.GetVoxel(image, Sequence);
|
var voxel = VoxelProvider.GetVoxel(image, Sequence);
|
||||||
var turretOffset = body.LocalToWorld(t.Offset.Rotate(orientation));
|
Func<WVec> turretOffset = () => body.LocalToWorld(t.Offset.Rotate(orientation()));
|
||||||
|
|
||||||
var turretFacing = Turreted.GetInitialTurretFacing(init, t.InitialFacing, Turret);
|
var turretFacing = Turreted.GetInitialTurretFacing(init, t.InitialFacing, Turret);
|
||||||
var turretBodyOrientation = new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(turretFacing) - orientation.Yaw);
|
Func<WRot> turretBodyOrientation = () => WRot.FromYaw(WAngle.FromFacing(turretFacing) - orientation().Yaw);
|
||||||
var turretOrientation = new[] { turretBodyOrientation, body.QuantizeOrientation(orientation, facings) };
|
yield return new VoxelAnimation(voxel, turretOffset,
|
||||||
yield return new VoxelAnimation(voxel, () => turretOffset, () => turretOrientation, () => false, () => 0);
|
() => new[] { turretBodyOrientation(), body.QuantizeOrientation(orientation(), facings) }, () => false, () => 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
var anim = new Animation(init.World, image, () => 0);
|
var anim = new Animation(init.World, image, () => 0);
|
||||||
anim.PlayFetchIndex(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence), () => adjacent);
|
anim.PlayFetchIndex(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence), () => adjacent);
|
||||||
|
|
||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, () => WVec.Zero, () => 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
string IWallConnectorInfo.GetWallConnectionType()
|
string IWallConnectorInfo.GetWallConnectionType()
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.D2k.Traits
|
|||||||
var anim = new Animation(init.World, image);
|
var anim = new Animation(init.World, image);
|
||||||
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), GrowthSequences[0]));
|
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), GrowthSequences[0]));
|
||||||
|
|
||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, () => WVec.Zero, () => 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,12 +30,13 @@ namespace OpenRA.Mods.TS.Traits.Render
|
|||||||
|
|
||||||
public object Create(ActorInitializer init) { return new WithVoxelUnloadBody(init.Self, this); }
|
public object Create(ActorInitializer init) { return new WithVoxelUnloadBody(init.Self, this); }
|
||||||
|
|
||||||
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, WRot orientation, int facings, PaletteReference p)
|
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(
|
||||||
|
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, "idle");
|
||||||
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);
|
() => false, () => 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user