Remove RenderSprites animation keys.
This commit is contained in:
@@ -45,8 +45,7 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
|
||||
overlay = new Animation(init.World, renderSprites.GetImage(init.Self));
|
||||
|
||||
var key = "attack_overlay_{0}".F(info.Sequence);
|
||||
renderSprites.Add(key, new AnimationWithOffset(overlay, null, () => !attacking),
|
||||
renderSprites.Add(new AnimationWithOffset(overlay, null, () => !attacking),
|
||||
info.Palette, info.IsPlayerPalette);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,16 +38,15 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
if (init.Contains<SkipMakeAnimsInit>())
|
||||
return;
|
||||
|
||||
var key = "make_overlay_{0}".F(info.Sequence);
|
||||
var rs = init.Self.Trait<RenderSprites>();
|
||||
|
||||
var overlay = new Animation(init.World, rs.GetImage(init.Self));
|
||||
var anim = new AnimationWithOffset(overlay, null, () => !buildComplete);
|
||||
|
||||
// Remove the animation once it is complete
|
||||
overlay.PlayThen(info.Sequence, () => init.World.AddFrameEndTask(w => rs.Remove(key)));
|
||||
overlay.PlayThen(info.Sequence, () => init.World.AddFrameEndTask(w => rs.Remove(anim)));
|
||||
|
||||
rs.Add(key, new AnimationWithOffset(overlay, null, () => !buildComplete),
|
||||
info.Palette, info.IsPlayerPalette);
|
||||
rs.Add(anim, info.Palette, info.IsPlayerPalette);
|
||||
}
|
||||
|
||||
public void BuildingComplete(Actor self)
|
||||
|
||||
@@ -35,9 +35,11 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
|
||||
public class WithDeliveryOverlay : INotifyBuildComplete, INotifySold, INotifyDelivery
|
||||
{
|
||||
WithDeliveryOverlayInfo info;
|
||||
Animation overlay;
|
||||
bool buildComplete, delivering;
|
||||
readonly WithDeliveryOverlayInfo info;
|
||||
readonly AnimationWithOffset anim;
|
||||
|
||||
bool buildComplete;
|
||||
bool delivering;
|
||||
|
||||
public WithDeliveryOverlay(Actor self, WithDeliveryOverlayInfo info)
|
||||
{
|
||||
@@ -46,21 +48,23 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
var rs = self.Trait<RenderSprites>();
|
||||
var body = self.Trait<IBodyOrientation>();
|
||||
|
||||
buildComplete = !self.HasTrait<Building>(); // always render instantly for units
|
||||
// always render instantly for units
|
||||
buildComplete = !self.HasTrait<Building>();
|
||||
|
||||
overlay = new Animation(self.World, rs.GetImage(self));
|
||||
var overlay = new Animation(self.World, rs.GetImage(self));
|
||||
overlay.Play(info.Sequence);
|
||||
rs.Add("delivery_overlay_{0}".F(info.Sequence),
|
||||
new AnimationWithOffset(overlay,
|
||||
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
|
||||
() => !buildComplete),
|
||||
info.Palette, info.IsPlayerPalette);
|
||||
|
||||
anim = new AnimationWithOffset(overlay,
|
||||
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
|
||||
() => !buildComplete);
|
||||
|
||||
rs.Add(anim, info.Palette, info.IsPlayerPalette);
|
||||
}
|
||||
|
||||
void PlayDeliveryOverlay()
|
||||
{
|
||||
if (delivering)
|
||||
overlay.PlayThen(info.Sequence, PlayDeliveryOverlay);
|
||||
anim.Animation.PlayThen(info.Sequence, PlayDeliveryOverlay);
|
||||
}
|
||||
|
||||
public void BuildingComplete(Actor self)
|
||||
|
||||
@@ -35,9 +35,10 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
|
||||
public class WithDockingOverlay : INotifyDocking, INotifyBuildComplete, INotifySold
|
||||
{
|
||||
WithDockingOverlayInfo info;
|
||||
Animation overlay;
|
||||
bool buildComplete, docked;
|
||||
readonly WithDockingOverlayInfo info;
|
||||
readonly AnimationWithOffset anim;
|
||||
bool buildComplete;
|
||||
bool docked;
|
||||
|
||||
public WithDockingOverlay(Actor self, WithDockingOverlayInfo info)
|
||||
{
|
||||
@@ -48,19 +49,20 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
|
||||
buildComplete = !self.HasTrait<Building>(); // always render instantly for units
|
||||
|
||||
overlay = new Animation(self.World, rs.GetImage(self));
|
||||
var overlay = new Animation(self.World, rs.GetImage(self));
|
||||
overlay.Play(info.Sequence);
|
||||
rs.Add("docking_overlay_{0}".F(info.Sequence),
|
||||
new AnimationWithOffset(overlay,
|
||||
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
|
||||
() => !buildComplete),
|
||||
info.Palette, info.IsPlayerPalette);
|
||||
|
||||
anim = new AnimationWithOffset(overlay,
|
||||
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
|
||||
() => !buildComplete);
|
||||
|
||||
rs.Add(anim, info.Palette, info.IsPlayerPalette);
|
||||
}
|
||||
|
||||
void PlayDockingOverlay()
|
||||
{
|
||||
if (docked)
|
||||
overlay.PlayThen(info.Sequence, PlayDockingOverlay);
|
||||
anim.Animation.PlayThen(info.Sequence, PlayDockingOverlay);
|
||||
}
|
||||
|
||||
public void BuildingComplete(Actor self)
|
||||
|
||||
Reference in New Issue
Block a user