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>
|
public class WithCrumbleOverlay : ConditionalTrait<WithCrumbleOverlayInfo>
|
||||||
{
|
{
|
||||||
|
readonly WithCrumbleOverlayInfo info;
|
||||||
|
readonly RenderSprites renderSprites;
|
||||||
|
readonly Animation overlay;
|
||||||
|
readonly AnimationWithOffset animation;
|
||||||
|
|
||||||
public WithCrumbleOverlay(ActorInitializer init, WithCrumbleOverlayInfo info)
|
public WithCrumbleOverlay(ActorInitializer init, WithCrumbleOverlayInfo info)
|
||||||
: base(info)
|
: base(info)
|
||||||
{
|
{
|
||||||
|
this.info = info;
|
||||||
|
|
||||||
if (init.Contains<SkipMakeAnimsInit>())
|
if (init.Contains<SkipMakeAnimsInit>())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var rs = init.Self.Trait<RenderSprites>();
|
renderSprites = init.Self.Trait<RenderSprites>();
|
||||||
|
|
||||||
var overlay = new Animation(init.World, rs.GetImage(init.Self));
|
overlay = new Animation(init.World, renderSprites.GetImage(init.Self));
|
||||||
var anim = new AnimationWithOffset(overlay, null, () => IsTraitDisabled);
|
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
|
// Remove the animation once it is complete
|
||||||
overlay.PlayThen(info.Sequence, () => init.World.AddFrameEndTask(w => rs.Remove(anim)));
|
overlay.PlayThen(info.Sequence, () => self.World.AddFrameEndTask(w => renderSprites.Remove(animation)));
|
||||||
|
|
||||||
rs.Add(anim, info.Palette, info.IsPlayerPalette);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -454,7 +454,6 @@
|
|||||||
-GivesBuildableArea:
|
-GivesBuildableArea:
|
||||||
WithMakeAnimation:
|
WithMakeAnimation:
|
||||||
BodyNames: make
|
BodyNames: make
|
||||||
-WithCrumbleOverlay:
|
|
||||||
-Capturable:
|
-Capturable:
|
||||||
WithSpriteBody:
|
WithSpriteBody:
|
||||||
Name: make
|
Name: make
|
||||||
|
|||||||
@@ -38,9 +38,11 @@ medium_gun_turret:
|
|||||||
Offset: -16,16
|
Offset: -16,16
|
||||||
ZOffset: 1024
|
ZOffset: 1024
|
||||||
crumble-overlay: DATA.R8
|
crumble-overlay: DATA.R8
|
||||||
Start: 4585
|
Start: 4584
|
||||||
Length: 7
|
Length: 7
|
||||||
Offset: -16,16
|
Offset: -16,16
|
||||||
|
Tick: 200
|
||||||
|
ZOffset: 1024
|
||||||
turret: DATA.R8
|
turret: DATA.R8
|
||||||
Start: 2837
|
Start: 2837
|
||||||
Facings: -32
|
Facings: -32
|
||||||
@@ -72,9 +74,11 @@ large_gun_turret:
|
|||||||
Offset: -16,16
|
Offset: -16,16
|
||||||
ZOffset: 1024
|
ZOffset: 1024
|
||||||
crumble-overlay: DATA.R8
|
crumble-overlay: DATA.R8
|
||||||
Start: 4585
|
Start: 4584
|
||||||
Length: 7
|
Length: 7
|
||||||
Offset: -16,16
|
Offset: -16,16
|
||||||
|
Tick: 200
|
||||||
|
ZOffset: 1024
|
||||||
turret: DATA.R8
|
turret: DATA.R8
|
||||||
Start: 2885
|
Start: 2885
|
||||||
Facings: -32
|
Facings: -32
|
||||||
|
|||||||
Reference in New Issue
Block a user