From ac18d0ab449dedbaca943ae5d741e039c5de565d Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Tue, 5 Jan 2010 00:08:05 +1300 Subject: [PATCH] Temporarily hack in a powerdown effect until we do it properly --- OpenRa.Game/Traits/Building.cs | 29 ++++++++++++++++++++++++++++- sequences.xml | 3 +++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/OpenRa.Game/Traits/Building.cs b/OpenRa.Game/Traits/Building.cs index e1c6215a88..0b2da8e38d 100644 --- a/OpenRa.Game/Traits/Building.cs +++ b/OpenRa.Game/Traits/Building.cs @@ -5,10 +5,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using OpenRa.Game.Effects; +using OpenRa.Game.Graphics; namespace OpenRa.Game.Traits { - class Building : INotifyDamage, IOrder, ITick + class Building : INotifyDamage, IOrder, ITick, IRenderModifier { readonly Actor self; public readonly BuildingInfo unitInfo; @@ -39,6 +40,32 @@ namespace OpenRa.Game.Traits return unitInfo.Power; } + public Animation iconAnim; + public IEnumerable + ModifyRender(Actor self, IEnumerable rs) + { + if (!InsuffientPower()) + return rs; + + List nrs = new List(rs); + foreach(var r in rs) + { + // Need 2 shadows to make it dark enough + nrs.Add(r.WithPalette(PaletteType.Shadow)); + nrs.Add(r.WithPalette(PaletteType.Shadow)); + } + + if (isPoweredDown) + { + iconAnim = new Animation("powerdown"); + iconAnim.PlayRepeating("disabled"); + nrs.Add(new Renderable(iconAnim.Image, self.CenterLocation - 0.5f*iconAnim.Image.size, PaletteType.Chrome)); + } + + + return nrs; + } + public void Damaged(Actor self, AttackInfo e) { if (e.DamageState == DamageState.Dead) diff --git a/sequences.xml b/sequences.xml index 2abe5428ed..b27ced5362 100644 --- a/sequences.xml +++ b/sequences.xml @@ -404,6 +404,9 @@ + + +