combat actually works

This commit is contained in:
Chris Forbes
2009-10-21 21:34:34 +13:00
parent 659c3669e7
commit 4382a10568
9 changed files with 81 additions and 30 deletions

View File

@@ -77,6 +77,27 @@ namespace OpenRa.Game
var loc = CenterLocation - 0.5f * size;
return new RectangleF(loc.X, loc.Y, size.X, size.Y);
}
}
public void InflictDamage(Actor attacker, Bullet inflictor, int damage)
{
/* todo: auto-retaliate, etc */
/* todo: death sequence for infantry based on inflictor */
/* todo: start smoking if < conditionYellow and took damage, and not already smoking
if (Health <= 0) return; /* overkill! */
Health -= damage;
if (Health <= 0)
{
Health = 0;
if (attacker.Owner != null)
attacker.Owner.Kills++;
Game.world.AddFrameEndTask(w => w.Remove(this));
/* todo: explosion */
}
}
}
}