From 51b88bfbaf2520b8bc2264f99d1a2ae0157394f0 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Mon, 23 May 2016 23:06:33 +0200 Subject: [PATCH] Remove Explosion effect and use SpriteEffect instead --- OpenRA.Mods.Common/Effects/Explosion.cs | 44 ------------------- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 1 - OpenRA.Mods.Common/Traits/Parachutable.cs | 2 +- .../Traits/Render/WithBuildingExplosion.cs | 2 +- .../Warheads/CreateEffectWarhead.cs | 2 +- 5 files changed, 3 insertions(+), 48 deletions(-) delete mode 100644 OpenRA.Mods.Common/Effects/Explosion.cs diff --git a/OpenRA.Mods.Common/Effects/Explosion.cs b/OpenRA.Mods.Common/Effects/Explosion.cs deleted file mode 100644 index a8038dc209..0000000000 --- a/OpenRA.Mods.Common/Effects/Explosion.cs +++ /dev/null @@ -1,44 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2016 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. For more - * information, see COPYING. - */ -#endregion - -using System.Collections.Generic; -using OpenRA.Effects; -using OpenRA.Graphics; - -namespace OpenRA.Mods.Common.Effects -{ - public class Explosion : IEffect - { - readonly World world; - readonly string palette; - readonly Animation anim; - WPos pos; - - public Explosion(World world, WPos pos, string image, string sequence, string palette) - { - this.world = world; - this.pos = pos; - this.palette = palette; - anim = new Animation(world, image); - anim.PlayThen(sequence, () => world.AddFrameEndTask(w => w.Remove(this))); - } - - public void Tick(World world) { anim.Tick(); } - - public IEnumerable Render(WorldRenderer wr) - { - if (world.FogObscures(pos)) - return SpriteRenderable.None; - - return anim.Render(pos, wr.Palette(palette)); - } - } -} diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 2e20f66a60..31a6d70103 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -152,7 +152,6 @@ - diff --git a/OpenRA.Mods.Common/Traits/Parachutable.cs b/OpenRA.Mods.Common/Traits/Parachutable.cs index d09224c5b5..07ae17057d 100644 --- a/OpenRA.Mods.Common/Traits/Parachutable.cs +++ b/OpenRA.Mods.Common/Traits/Parachutable.cs @@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits var sequence = terrain.IsWater ? info.WaterCorpseSequence : info.GroundCorpseSequence; var palette = terrain.IsWater ? info.WaterCorpsePalette : info.GroundCorpsePalette; if (sequence != null && palette != null) - self.World.AddFrameEndTask(w => w.Add(new Explosion(w, self.OccupiesSpace.CenterPosition, info.Image, sequence, palette))); + self.World.AddFrameEndTask(w => w.Add(new SpriteEffect(self.OccupiesSpace.CenterPosition, w, info.Image, sequence, palette))); self.Kill(self); } diff --git a/OpenRA.Mods.Common/Traits/Render/WithBuildingExplosion.cs b/OpenRA.Mods.Common/Traits/Render/WithBuildingExplosion.cs index 166a41210c..b31f1a1985 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithBuildingExplosion.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithBuildingExplosion.cs @@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits.Render void SpawnExplosions(World world, IEnumerable cells) { foreach (var c in cells) - world.AddFrameEndTask(w => w.Add(new Explosion(w, w.Map.CenterOfCell(c), info.Image, info.Sequences.Random(w.SharedRandom), info.Palette))); + world.AddFrameEndTask(w => w.Add(new SpriteEffect(w.Map.CenterOfCell(c), w, info.Image, info.Sequences.Random(w.SharedRandom), info.Palette))); } } } diff --git a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs index b618ec4dea..62a0b76e5f 100644 --- a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs @@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Warheads var explosion = Explosions.RandomOrDefault(Game.CosmeticRandom); if (Image != null && explosion != null) - world.AddFrameEndTask(w => w.Add(new Explosion(w, pos, Image, explosion, palette))); + world.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, w, Image, explosion, palette))); var impactSound = ImpactSounds.RandomOrDefault(Game.CosmeticRandom); if (impactSound != null)