Add facings support to SpriteEffect

This commit is contained in:
reaperrr
2016-04-13 21:01:56 +02:00
parent e781bf3e0d
commit ca7a17ea06
3 changed files with 4 additions and 4 deletions

View File

@@ -23,14 +23,14 @@ namespace OpenRA.Effects
readonly bool visibleThroughFog; readonly bool visibleThroughFog;
readonly bool scaleSizeWithZoom; readonly bool scaleSizeWithZoom;
public SpriteEffect(WPos pos, World world, string image, string sequence, string palette, bool visibleThroughFog = false, bool scaleSizeWithZoom = false) public SpriteEffect(WPos pos, World world, string image, string sequence, string palette, int facing = 0, bool visibleThroughFog = false, bool scaleSizeWithZoom = false)
{ {
this.world = world; this.world = world;
this.pos = pos; this.pos = pos;
this.palette = palette; this.palette = palette;
this.scaleSizeWithZoom = scaleSizeWithZoom; this.scaleSizeWithZoom = scaleSizeWithZoom;
this.visibleThroughFog = visibleThroughFog; this.visibleThroughFog = visibleThroughFog;
anim = new Animation(world, image); anim = new Animation(world, image, () => facing);
anim.PlayThen(sequence, () => world.AddFrameEndTask(w => w.Remove(this))); anim.PlayThen(sequence, () => world.AddFrameEndTask(w => w.Remove(this)));
} }

View File

@@ -199,7 +199,7 @@ namespace OpenRA.Widgets
else if (o.TargetLocation != CPos.Zero) else if (o.TargetLocation != CPos.Zero)
{ {
var pos = world.Map.CenterOfCell(cell); var pos = world.Map.CenterOfCell(cell);
world.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, world, "moveflsh", "idle", "moveflash", true, true))); world.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, world, "moveflsh", "idle", "moveflash", 0, true, true)));
flashed = true; flashed = true;
} }
} }

View File

@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits.Render
if (Info.TerrainTypes.Contains(type) && !string.IsNullOrEmpty(Info.Image)) if (Info.TerrainTypes.Contains(type) && !string.IsNullOrEmpty(Info.Image))
self.World.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, self.World, Info.Image, self.World.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, self.World, Info.Image,
Info.Sequences.Random(Game.CosmeticRandom), Info.Palette, Info.VisibleThroughFog))); Info.Sequences.Random(Game.CosmeticRandom), Info.Palette, 0, Info.VisibleThroughFog)));
cachedPosition = self.CenterPosition; cachedPosition = self.CenterPosition;
ticks = 0; ticks = 0;