From 03d203e64a63cbe122f038b57ab7ffc4704f8505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Tue, 2 Apr 2013 22:07:26 +0200 Subject: [PATCH] added durationbar indicator for iron curtain, closes #2288 --- OpenRA.Mods.RA/IronCurtainable.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.RA/IronCurtainable.cs b/OpenRA.Mods.RA/IronCurtainable.cs index 02239e47bd..1b64da6b79 100644 --- a/OpenRA.Mods.RA/IronCurtainable.cs +++ b/OpenRA.Mods.RA/IronCurtainable.cs @@ -8,6 +8,7 @@ */ #endregion +using System.Drawing; using OpenRA.GameRules; using OpenRA.Mods.RA.Effects; using OpenRA.Traits; @@ -16,9 +17,10 @@ namespace OpenRA.Mods.RA { class IronCurtainableInfo : TraitInfo { } - class IronCurtainable : IDamageModifier, ITick, ISync + class IronCurtainable : IDamageModifier, ITick, ISync, ISelectionBar { [Sync] int RemainingTicks = 0; + int TotalTicks; public void Tick(Actor self) { @@ -37,6 +39,15 @@ namespace OpenRA.Mods.RA self.World.AddFrameEndTask(w => w.Add(new InvulnEffect(self))); // do not stack the invuln effect RemainingTicks = duration; + TotalTicks = duration; } + + // Show the remaining time as a bar + public float GetValue() + { + return (float)RemainingTicks / TotalTicks; + } + + public Color GetColor() { return Color.Red; } } } \ No newline at end of file