Draw repair and power down indicators above the shroud.

This commit is contained in:
Paul Chote
2016-08-23 16:34:24 +01:00
parent f357163078
commit cd0ba2049f
2 changed files with 10 additions and 6 deletions

View File

@@ -16,7 +16,7 @@ using OpenRA.Mods.Common.Traits;
namespace OpenRA.Mods.Common.Effects namespace OpenRA.Mods.Common.Effects
{ {
class PowerdownIndicator : IEffect class PowerdownIndicator : IEffect, IEffectAboveShroud
{ {
readonly Actor a; readonly Actor a;
readonly Animation anim; readonly Animation anim;
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Effects
anim.PlayRepeating(canPowerDown.Info.IndicatorSequence); anim.PlayRepeating(canPowerDown.Info.IndicatorSequence);
} }
public void Tick(World world) void IEffect.Tick(World world)
{ {
if (!a.IsInWorld || a.IsDead || !canPowerDown.Disabled) if (!a.IsInWorld || a.IsDead || !canPowerDown.Disabled)
world.AddFrameEndTask(w => w.Remove(this)); world.AddFrameEndTask(w => w.Remove(this));
@@ -39,7 +39,9 @@ namespace OpenRA.Mods.Common.Effects
anim.Tick(); anim.Tick();
} }
public IEnumerable<IRenderable> Render(WorldRenderer wr) IEnumerable<IRenderable> IEffect.Render(WorldRenderer wr) { return SpriteRenderable.None; }
IEnumerable<IRenderable> IEffectAboveShroud.RenderAboveShroud(WorldRenderer wr)
{ {
if (a.Disposed || wr.World.FogObscures(a)) if (a.Disposed || wr.World.FogObscures(a))
return SpriteRenderable.None; return SpriteRenderable.None;

View File

@@ -17,7 +17,7 @@ using OpenRA.Mods.Common.Traits;
namespace OpenRA.Mods.Common.Effects namespace OpenRA.Mods.Common.Effects
{ {
class RepairIndicator : IEffect class RepairIndicator : IEffect, IEffectAboveShroud
{ {
readonly Actor building; readonly Actor building;
readonly Animation anim; readonly Animation anim;
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Effects
CycleRepairer(); CycleRepairer();
} }
public void Tick(World world) void IEffect.Tick(World world)
{ {
if (!building.IsInWorld || building.IsDead || !rb.Repairers.Any()) if (!building.IsInWorld || building.IsDead || !rb.Repairers.Any())
world.AddFrameEndTask(w => w.Remove(this)); world.AddFrameEndTask(w => w.Remove(this));
@@ -43,7 +43,9 @@ namespace OpenRA.Mods.Common.Effects
anim.Tick(); anim.Tick();
} }
public IEnumerable<IRenderable> Render(WorldRenderer wr) IEnumerable<IRenderable> IEffect.Render(WorldRenderer wr) { return SpriteRenderable.None; }
IEnumerable<IRenderable> IEffectAboveShroud.RenderAboveShroud(WorldRenderer wr)
{ {
if (building.Disposed || rb.Repairers.Count == 0 || wr.World.FogObscures(building)) if (building.Disposed || rb.Repairers.Count == 0 || wr.World.FogObscures(building))
return SpriteRenderable.None; return SpriteRenderable.None;