Add the crumble overlay to the turrets.
This commit is contained in:
committed by
Paul Chote
parent
1f02d9f141
commit
4b0ab6ab37
@@ -35,21 +35,34 @@ namespace OpenRA.Mods.D2k.Traits.Render
|
||||
|
||||
public class WithCrumbleOverlay : ConditionalTrait<WithCrumbleOverlayInfo>
|
||||
{
|
||||
readonly WithCrumbleOverlayInfo info;
|
||||
readonly RenderSprites renderSprites;
|
||||
readonly Animation overlay;
|
||||
readonly AnimationWithOffset animation;
|
||||
|
||||
public WithCrumbleOverlay(ActorInitializer init, WithCrumbleOverlayInfo info)
|
||||
: base(info)
|
||||
{
|
||||
this.info = info;
|
||||
|
||||
if (init.Contains<SkipMakeAnimsInit>())
|
||||
return;
|
||||
|
||||
var rs = init.Self.Trait<RenderSprites>();
|
||||
renderSprites = init.Self.Trait<RenderSprites>();
|
||||
|
||||
var overlay = new Animation(init.World, rs.GetImage(init.Self));
|
||||
var anim = new AnimationWithOffset(overlay, null, () => IsTraitDisabled);
|
||||
overlay = new Animation(init.World, renderSprites.GetImage(init.Self));
|
||||
animation = new AnimationWithOffset(overlay, null, () => IsTraitDisabled);
|
||||
}
|
||||
|
||||
protected override void TraitEnabled(Actor self)
|
||||
{
|
||||
if (overlay == null)
|
||||
return;
|
||||
|
||||
renderSprites.Add(animation, info.Palette, info.IsPlayerPalette);
|
||||
|
||||
// Remove the animation once it is complete
|
||||
overlay.PlayThen(info.Sequence, () => init.World.AddFrameEndTask(w => rs.Remove(anim)));
|
||||
|
||||
rs.Add(anim, info.Palette, info.IsPlayerPalette);
|
||||
overlay.PlayThen(info.Sequence, () => self.World.AddFrameEndTask(w => renderSprites.Remove(animation)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,7 +454,6 @@
|
||||
-GivesBuildableArea:
|
||||
WithMakeAnimation:
|
||||
BodyNames: make
|
||||
-WithCrumbleOverlay:
|
||||
-Capturable:
|
||||
WithSpriteBody:
|
||||
Name: make
|
||||
|
||||
@@ -38,9 +38,11 @@ medium_gun_turret:
|
||||
Offset: -16,16
|
||||
ZOffset: 1024
|
||||
crumble-overlay: DATA.R8
|
||||
Start: 4585
|
||||
Start: 4584
|
||||
Length: 7
|
||||
Offset: -16,16
|
||||
Tick: 200
|
||||
ZOffset: 1024
|
||||
turret: DATA.R8
|
||||
Start: 2837
|
||||
Facings: -32
|
||||
@@ -72,9 +74,11 @@ large_gun_turret:
|
||||
Offset: -16,16
|
||||
ZOffset: 1024
|
||||
crumble-overlay: DATA.R8
|
||||
Start: 4585
|
||||
Start: 4584
|
||||
Length: 7
|
||||
Offset: -16,16
|
||||
Tick: 200
|
||||
ZOffset: 1024
|
||||
turret: DATA.R8
|
||||
Start: 2885
|
||||
Facings: -32
|
||||
|
||||
Reference in New Issue
Block a user