lots of stuff: harvester, acceptsore, half-destroyed buildings, building sounds

This commit is contained in:
Chris Forbes
2009-11-01 18:51:15 +13:00
parent 5dbc70da02
commit f9fb04372c
12 changed files with 109 additions and 14 deletions

View File

@@ -7,7 +7,8 @@ using IjwFramework.Types;
using OpenRa.FileFormats;
using OpenRa.Game.GameRules;
using OpenRa.Game.Graphics;
using System.Drawing;
using System.Drawing;
using OpenRa.Game.Traits;
namespace OpenRa.Game
{
@@ -105,10 +106,22 @@ namespace OpenRa.Game
Game.world.AddFrameEndTask(w => w.Remove(this));
if (Owner == Game.LocalPlayer)
Game.PlaySound("unitlst1.aud", false);
/* todo: explosion */
if (Owner == Game.LocalPlayer && !traits.Contains<Building>())
Game.PlaySound("unitlst1.aud", false);
if (traits.Contains<Building>())
{
Game.PlaySound("kaboom22.aud", false);
// todo: spawn explosion sprites
}
}
var halfStrength = unitInfo.Strength / 2;
if (Health < halfStrength && (Health + damage) >= halfStrength)
{
/* we just went below half health! */
foreach (var nd in traits.WithInterface<INotifyDamage>())
nd.Damaged(this, DamageState.Half);
}
}
}