Add an image override.
This commit is contained in:
committed by
teinarss
parent
2d36d0a659
commit
657e690bdd
@@ -20,11 +20,14 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
[Desc("Renders a decorative animation on units and buildings.")]
|
[Desc("Renders a decorative animation on units and buildings.")]
|
||||||
public class WithIdleOverlayInfo : PausableConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<BodyOrientationInfo>
|
public class WithIdleOverlayInfo : PausableConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<BodyOrientationInfo>
|
||||||
{
|
{
|
||||||
[SequenceReference]
|
[Desc("Image used for this decoration. Defaults to the actor's type.")]
|
||||||
|
public readonly string Image = null;
|
||||||
|
|
||||||
|
[SequenceReference("Image")]
|
||||||
[Desc("Animation to play when the actor is created.")]
|
[Desc("Animation to play when the actor is created.")]
|
||||||
public readonly string StartSequence = null;
|
public readonly string StartSequence = null;
|
||||||
|
|
||||||
[SequenceReference]
|
[SequenceReference("Image")]
|
||||||
[Desc("Sequence name to use")]
|
[Desc("Sequence name to use")]
|
||||||
public readonly string Sequence = "idle-overlay";
|
public readonly string Sequence = "idle-overlay";
|
||||||
|
|
||||||
@@ -87,7 +90,8 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
var rs = self.Trait<RenderSprites>();
|
var rs = self.Trait<RenderSprites>();
|
||||||
var body = self.Trait<BodyOrientation>();
|
var body = self.Trait<BodyOrientation>();
|
||||||
|
|
||||||
overlay = new Animation(self.World, rs.GetImage(self), () => IsTraitPaused);
|
var image = info.Image ?? rs.GetImage(self);
|
||||||
|
overlay = new Animation(self.World, image, () => IsTraitPaused);
|
||||||
overlay.IsDecoration = info.IsDecoration;
|
overlay.IsDecoration = info.IsDecoration;
|
||||||
if (info.StartSequence != null)
|
if (info.StartSequence != null)
|
||||||
overlay.PlayThen(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.StartSequence),
|
overlay.PlayThen(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.StartSequence),
|
||||||
|
|||||||
Reference in New Issue
Block a user