diff --git a/OpenRa.Mods.RA/Crate Actions/SpeedUpgrade.cs b/OpenRa.Mods.RA/Crate Actions/SpeedUpgrade.cs index c7120a18c7..a899e91efa 100644 --- a/OpenRa.Mods.RA/Crate Actions/SpeedUpgrade.cs +++ b/OpenRa.Mods.RA/Crate Actions/SpeedUpgrade.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using OpenRa.Mods.RA.Effects; using OpenRa.Traits; -using OpenRa.Mods.RA.Effects; namespace OpenRa.Mods.RA { @@ -32,7 +29,7 @@ namespace OpenRa.Mods.RA { float multiplier = self.Info.Traits.Get().Multiplier; collector.traits.Add(new SpeedUpgrade(multiplier)); - w.Add(new CrateEffectSpeedUpgrade(collector)); + w.Add(new CrateEffect(collector, "speed")); }); } } diff --git a/OpenRa.Mods.RA/Effects/CrateEffect.cs b/OpenRa.Mods.RA/Effects/CrateEffect.cs new file mode 100644 index 0000000000..152e396786 --- /dev/null +++ b/OpenRa.Mods.RA/Effects/CrateEffect.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using OpenRa.Effects; +using OpenRa.Graphics; +using OpenRa.Traits; + +namespace OpenRa.Mods.RA.Effects +{ + class CrateEffect : IEffect + { + Actor a; + Animation anim = new Animation("crate-effects"); + float2 doorOffset = new float2(-4,0); + + public CrateEffect(Actor a, string seq) + { + this.a = a; + anim.PlayThen(seq, + () => a.World.AddFrameEndTask(w => w.Remove(this))); + } + + public void Tick( World world ) + { + anim.Tick(); + } + + public IEnumerable Render() + { + yield return new Renderable(anim.Image, + a.CenterLocation - .5f * anim.Image.size + doorOffset, PaletteType.Gold); + } + } +} diff --git a/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj b/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj index ccb41cc2ff..188136c025 100644 --- a/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj +++ b/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj @@ -52,7 +52,7 @@ - +