This commit is contained in:
Chris Forbes
2009-12-05 12:30:46 +13:00
parent c171185034
commit c630e6a0a7
4 changed files with 57 additions and 7 deletions

View File

@@ -72,20 +72,36 @@ namespace OpenRa.Game
{
Game.world.AddFrameEndTask(w =>
{
w.Remove(this);
w.Remove(this);
var isWater = Game.IsCellBuildable(
((1f / Game.CellSize) * Dest.ToFloat2()).ToInt2(), UnitMovementType.Float);
var targetTile = ((1f / Game.CellSize) * Dest.ToFloat2()).ToInt2();
var isWater = Game.IsWater(targetTile);
var hitWater = Game.IsCellBuildable(targetTile, UnitMovementType.Float);
if (Warhead.Explosion != 0)
w.Add(new Explosion(VisualDest, Warhead.Explosion, isWater));
w.Add(new Explosion(VisualDest, Warhead.Explosion, hitWater));
var impact = Warhead.ImpactSound;
if (isWater && Warhead.WaterImpactSound != null)
if (hitWater && Warhead.WaterImpactSound != null)
impact = Warhead.WaterImpactSound;
if (impact != null)
Game.PlaySound(impact+ ".aud", false);
if (!isWater)
switch( Warhead.Explosion ) /* todo: push the scorch/crater behavior into data */
{
case 4:
case 5:
Smudge.AddSmudge(true, targetTile.X, targetTile.Y);
break;
case 3:
case 6:
Smudge.AddSmudge(false, targetTile.X, targetTile.Y);
break;
}
});
var maxSpread = GetMaximumSpread();