added IsDead property; made attack notice when the target is dead

This commit is contained in:
Chris Forbes
2009-10-22 23:13:33 +13:00
parent 1effd85d50
commit cfa20a04ed
2 changed files with 8 additions and 0 deletions

View File

@@ -79,6 +79,8 @@ namespace OpenRa.Game
}
}
public bool IsDead { get { return Health <= 0; } }
public void InflictDamage(Actor attacker, Bullet inflictor, int damage)
{
/* todo: auto-retaliate, etc */

View File

@@ -28,6 +28,12 @@ namespace OpenRa.Game.Traits
if( target == null )
return;
if (target.IsDead) /* stop firing on targets after we've killed them */
{
target = null;
return;
}
var turreted = self.traits.Get<Turreted>();
turreted.desiredFacing = Util.GetFacing( target.CenterLocation - self.CenterLocation, turreted.turretFacing );
if( turreted.desiredFacing != turreted.turretFacing )