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