fix Bridge init

This commit is contained in:
Chris Forbes
2010-07-30 18:24:12 +12:00
parent e1a0d40530
commit d6b8b327d9
2 changed files with 8 additions and 4 deletions

View File

@@ -43,8 +43,12 @@ namespace OpenRA.Traits
} }
public int HP { get { return hp; } } public int HP { get { return hp; } }
public readonly int MaxHP; public readonly int MaxHP;
public float HPFraction { get { return hp*1f/MaxHP; } } public float HPFraction
{
get { return hp * 1f / MaxHP; }
set { hp = (int)(value * MaxHP); }
}
public bool IsDead { get { return hp <= 0; } } public bool IsDead { get { return hp <= 0; } }
public bool RemoveOnDeath = true; public bool RemoveOnDeath = true;

View File

@@ -90,9 +90,9 @@ namespace OpenRA.Mods.RA
{ {
currentTemplate = template; currentTemplate = template;
if (template == Info.DamagedTemplate) if (template == Info.DamagedTemplate)
Health.InflictDamage(self, self, Health.MaxHP/2, null); Health.HPFraction = .5f;
else if (template != Info.Template) else if (template != Info.Template)
Health.InflictDamage(self, self, Health.MaxHP, null); Health.HPFraction = 0f;
// Create a new cache to store the tile data // Create a new cache to store the tile data
if (cachedTileset != self.World.Map.Tileset) if (cachedTileset != self.World.Map.Tileset)