Convert Explosion to world coords.
This commit is contained in:
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
if (explosionType != null)
|
||||
world.AddFrameEndTask(
|
||||
w => w.Add(new Explosion(w, args.dest, explosionType, isWater, args.destAltitude)));
|
||||
w => w.Add(new Explosion(w, args.dest.ToWPos(args.destAltitude), explosionType)));
|
||||
|
||||
Sound.Play(GetImpactSound(warhead, isWater), args.dest);
|
||||
|
||||
|
||||
@@ -18,26 +18,20 @@ namespace OpenRA.Mods.RA.Effects
|
||||
public class Explosion : IEffect
|
||||
{
|
||||
Animation anim;
|
||||
PPos pos;
|
||||
int altitude;
|
||||
WPos pos;
|
||||
|
||||
public Explosion(World world, PPos pixelPos, string style, bool isWater, int altitude)
|
||||
public Explosion(World world, WPos pos, string style)
|
||||
{
|
||||
this.pos = pixelPos;
|
||||
this.altitude = altitude;
|
||||
this.pos = pos;
|
||||
anim = new Animation("explosion");
|
||||
anim.PlayThen(style,
|
||||
() => world.AddFrameEndTask(w => w.Remove(this)));
|
||||
anim.PlayThen(style, () => world.AddFrameEndTask(w => w.Remove(this)));
|
||||
}
|
||||
|
||||
public void Tick( World world ) { anim.Tick(); }
|
||||
|
||||
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
||||
{
|
||||
var p = pos.ToInt2() - new int2(0, altitude);
|
||||
yield return new SpriteRenderable(anim.Image, p, wr.Palette("effect"), p.Y);
|
||||
yield return new SpriteRenderable(anim.Image, pos, 0, wr.Palette("effect"), 1f);
|
||||
}
|
||||
|
||||
public Player Owner { get { return null; } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
var bi = self.Info.Traits.Get<BuildingInfo>();
|
||||
FootprintUtils.UnpathableTiles(self.Info.Name, bi, self.Location).Do(
|
||||
t => self.World.AddFrameEndTask(
|
||||
w => w.Add(new Explosion(w, Traits.Util.CenterOfCell(t), "building", false, 0))));
|
||||
w => w.Add(new Explosion(w, t.CenterPosition, "building"))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user