#157 explosions weren't taking altitude into account

This commit is contained in:
Chris Forbes
2010-10-16 09:30:32 +13:00
parent f28c8903aa
commit 999eef2ec9
3 changed files with 8 additions and 4 deletions

View File

@@ -44,7 +44,7 @@ namespace OpenRA.Mods.RA
if (explosionType != null)
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);

View File

@@ -19,10 +19,12 @@ namespace OpenRA.Mods.RA.Effects
{
Animation anim;
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.altitude = altitude;
anim = new Animation("explosion");
anim.PlayThen(style,
() => world.AddFrameEndTask(w => w.Remove(this)));
@@ -32,7 +34,9 @@ namespace OpenRA.Mods.RA.Effects
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; } }

View File

@@ -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 ))
{
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)
{