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.isPlayerPalette = isPlayerPalette;
if (!string.IsNullOrEmpty(arrowSprite))
{
arrow = new Animation(owner.World, beaconCollection);
circles = new Animation(owner.World, beaconCollection);
arrow.Play(arrowSprite);
}
if (!string.IsNullOrEmpty(circleSprite))
{
circles = new Animation(owner.World, beaconCollection);
circles.Play(circleSprite);
}
if (duration > 0)
owner.World.Add(new DelayedAction(duration, () => owner.World.Remove(this)));
@@ -82,7 +88,10 @@ namespace OpenRA.Mods.Common.Effects
arrowSpeed *= -1;
}
if (arrow != null)
arrow.Tick();
if (circles != null)
circles.Tick();
if (clock != null)
@@ -95,9 +104,12 @@ namespace OpenRA.Mods.Common.Effects
yield break;
var palette = r.Palette(isPlayerPalette ? beaconPalette + owner.InternalName : beaconPalette);
if (circles != null)
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;