#157 explosions weren't taking altitude into account
This commit is contained in:
@@ -44,7 +44,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)));
|
w => w.Add(new Explosion(w, args.dest, explosionType, isWater, args.destAltitude)));
|
||||||
|
|
||||||
Sound.Play(GetImpactSound(warhead, isWater), args.dest);
|
Sound.Play(GetImpactSound(warhead, isWater), args.dest);
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,12 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
{
|
{
|
||||||
Animation anim;
|
Animation anim;
|
||||||
int2 pos;
|
int2 pos;
|
||||||
|
int altitude;
|
||||||
|
|
||||||
public Explosion(World world, int2 pixelPos, string style, bool isWater)
|
public Explosion(World world, int2 pixelPos, string style, bool isWater, int altitude)
|
||||||
{
|
{
|
||||||
this.pos = pixelPos;
|
this.pos = pixelPos;
|
||||||
|
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)));
|
||||||
@@ -32,7 +34,9 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
|
|
||||||
public IEnumerable<Renderable> Render()
|
public IEnumerable<Renderable> Render()
|
||||||
{
|
{
|
||||||
yield return new Renderable(anim.Image, pos - .5f * anim.Image.size, "effect", (int)pos.Y);
|
yield return new Renderable(anim.Image,
|
||||||
|
pos - .5f * anim.Image.size - new int2(0,altitude),
|
||||||
|
"effect", (int)pos.Y - altitude);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player Owner { get { return null; } }
|
public Player Owner { get { return null; } }
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
foreach (var t in Footprint.UnpathableTiles( self.Info.Name, self.Info.Traits.Get<BuildingInfo>(), self.Location ))
|
foreach (var t in Footprint.UnpathableTiles( self.Info.Name, self.Info.Traits.Get<BuildingInfo>(), self.Location ))
|
||||||
{
|
{
|
||||||
var cell = t; // required: c# fails at bindings
|
var cell = t; // required: c# fails at bindings
|
||||||
self.World.AddFrameEndTask(w => w.Add(new Explosion(w, Util.CenterOfCell(cell), "building", false)));
|
self.World.AddFrameEndTask(w => w.Add(new Explosion(w, Util.CenterOfCell(cell), "building", false, 0)));
|
||||||
}
|
}
|
||||||
else if (e.DamageState >= DamageState.Heavy && e.PreviousDamageState < DamageState.Heavy)
|
else if (e.DamageState >= DamageState.Heavy && e.PreviousDamageState < DamageState.Heavy)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user