diff --git a/OpenRA.Game/Effects/MoveFlash.cs b/OpenRA.Game/Effects/SpriteEffect.cs similarity index 60% rename from OpenRA.Game/Effects/MoveFlash.cs rename to OpenRA.Game/Effects/SpriteEffect.cs index 63c70814b5..db8c00bfcd 100644 --- a/OpenRA.Game/Effects/MoveFlash.cs +++ b/OpenRA.Game/Effects/SpriteEffect.cs @@ -1,6 +1,6 @@ -#region Copyright & License Information +#region Copyright & License Information /* - * Copyright 2007-2013 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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. For more information, @@ -13,15 +13,17 @@ using OpenRA.Graphics; namespace OpenRA.Effects { - public class MoveFlash : IEffect + public class SpriteEffect : IEffect { + string palette; Animation anim; WPos pos; - public MoveFlash(WPos pos, World world) + public SpriteEffect(WPos pos, World world, string sprite, string palette) { this.pos = pos; - anim = new Animation(world, "moveflsh"); + this.palette = palette; + anim = new Animation(world, sprite); anim.PlayThen("idle", () => world.AddFrameEndTask(w => w.Remove(this))); } @@ -32,7 +34,7 @@ namespace OpenRA.Effects public IEnumerable Render(WorldRenderer wr) { - return anim.Render(pos, WVec.Zero, 0, wr.Palette("moveflash"), 1f / wr.Viewport.Zoom); + return anim.Render(pos, WVec.Zero, 0, wr.Palette(palette), 1f / wr.Viewport.Zoom); } } } \ No newline at end of file diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 7a159f5ca3..467a2ffe1b 100644 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -212,7 +212,6 @@ - @@ -243,6 +242,7 @@ + diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index 7dc0ac36ae..fe2ba2bc7b 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -160,7 +160,7 @@ namespace OpenRA.Widgets } else if (o.TargetLocation != CPos.Zero) { - world.AddFrameEndTask(w => w.Add(new MoveFlash(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world))); + world.AddFrameEndTask(w => w.Add(new SpriteEffect(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world, "moveflsh", "moveflash"))); flashed = true; } }