explosions are more or less correct now

This commit is contained in:
Chris Forbes
2009-10-29 22:04:04 +13:00
parent 9d543db7fc
commit 066ce1a203
8 changed files with 47 additions and 25 deletions

View File

@@ -59,9 +59,15 @@ namespace OpenRa.Game
t += 40;
if (t > TotalTime()) /* remove finished bullets */
{
Game.world.AddFrameEndTask(w => w.Remove(this));
Game.world.AddFrameEndTask(w => w.Add(new Explosion(Dest)));
{
Game.world.AddFrameEndTask(w =>
{
w.Remove(this);
w.Add(new Explosion(Dest, Warhead.Explosion));
if (Warhead.ImpactSound != null)
Game.PlaySound(Warhead.ImpactSound + ".aud", false);
});
var maxSpread = GetMaximumSpread();
var hitActors = Game.FindUnitsInCircle(Dest, GetMaximumSpread());

View File

@@ -13,13 +13,15 @@ namespace OpenRa.Game
Animation anim;
int2 pos;
public Explosion(int2 pixelPos)
public Explosion(int2 pixelPos, int style)
{
this.pos = pixelPos;
anim = new Animation("veh-hit3");
anim.PlayThen("idle", () => Game.world.AddFrameEndTask(w => w.Remove(this)));
Game.PlaySound("kaboom25.aud", false);
anim = new Animation("explosion");
if (style != 0)
anim.PlayThen(style.ToString(), () => Game.world.AddFrameEndTask(w => w.Remove(this)));
else
Game.world.AddFrameEndTask(w => w.Remove(this));
}
public void Tick() { anim.Tick(); }

View File

@@ -16,6 +16,8 @@ namespace OpenRa.Game.GameRules
public readonly bool Ore = false;
public readonly int Explosion = 0;
public readonly int InfDeath = 0;
public readonly string ImpactSound = null;
public readonly string WaterImpactSound = null;
public float EffectivenessAgainst(ArmorType at) { return Verses[ (int)at ]; }
}

View File

@@ -13,7 +13,7 @@ namespace OpenRa.Game.Graphics
public Animation( string name )
{
this.name = name.ToLowerInvariant();
Play( "idle" );
// Play( "idle" );
}
public Sprite Image

View File

@@ -37,7 +37,8 @@ namespace OpenRa.Game.Traits
public override void Tick(Actor self)
{
base.Tick(self);
roof.Tick();
if (doneBuilding)
roof.Tick();
var b = self.Bounds;
if (isOpen && !Game.SelectUnitsInBox(