Merge pull request #11216 from abcdefg30/supportBeacon

Make the circle and arrow sequences of Beacon optional
This commit is contained in:
Matthias Mailänder
2016-05-02 22:27:12 +02:00

View File

@@ -42,11 +42,17 @@ namespace OpenRA.Mods.Common.Effects
this.beaconPalette = beaconPalette; this.beaconPalette = beaconPalette;
this.isPlayerPalette = isPlayerPalette; this.isPlayerPalette = isPlayerPalette;
arrow = new Animation(owner.World, beaconCollection); if (!string.IsNullOrEmpty(arrowSprite))
circles = new Animation(owner.World, beaconCollection); {
arrow = new Animation(owner.World, beaconCollection);
arrow.Play(arrowSprite);
}
arrow.Play(arrowSprite); if (!string.IsNullOrEmpty(circleSprite))
circles.Play(circleSprite); {
circles = new Animation(owner.World, beaconCollection);
circles.Play(circleSprite);
}
if (duration > 0) if (duration > 0)
owner.World.Add(new DelayedAction(duration, () => owner.World.Remove(this))); owner.World.Add(new DelayedAction(duration, () => owner.World.Remove(this)));
@@ -82,8 +88,11 @@ namespace OpenRA.Mods.Common.Effects
arrowSpeed *= -1; arrowSpeed *= -1;
} }
arrow.Tick(); if (arrow != null)
circles.Tick(); arrow.Tick();
if (circles != null)
circles.Tick();
if (clock != null) if (clock != null)
clock.Tick(); clock.Tick();
@@ -95,11 +104,14 @@ namespace OpenRA.Mods.Common.Effects
yield break; yield break;
var palette = r.Palette(isPlayerPalette ? beaconPalette + owner.InternalName : beaconPalette); var palette = r.Palette(isPlayerPalette ? beaconPalette + owner.InternalName : beaconPalette);
foreach (var a in circles.Render(position, palette))
yield return a;
foreach (var a in arrow.Render(position + new WVec(0, 0, arrowHeight), palette)) if (circles != null)
yield return a; foreach (var a in circles.Render(position, palette))
yield return a;
if (arrow != null)
foreach (var a in arrow.Render(position + new WVec(0, 0, arrowHeight), palette))
yield return a;
if (poster != null) if (poster != null)
{ {