Re-enabled repairtool character damage

This commit is contained in:
Regalis
2016-02-13 21:24:41 +02:00
parent 08f1d05507
commit 9b5e78fce4
4 changed files with 31 additions and 7 deletions
@@ -69,6 +69,13 @@ namespace Barotrauma
if (GameMain.DebugDraw && !isDead) aiController.DebugDraw(spriteBatch);
}
public override void AddDamage(CauseOfDeath causeOfDeath, float amount, IDamageable attacker)
{
base.AddDamage(causeOfDeath, amount, attacker);
if (attacker!=null) aiController.OnAttacked(attacker, amount);
}
public override AttackResult AddDamage(IDamageable attacker, Vector2 position, Attack attack, float deltaTime, bool playSound = false)
{
AttackResult result = base.AddDamage(attacker, position, attack, deltaTime, playSound);
+10 -5
View File
@@ -1044,9 +1044,14 @@ namespace Barotrauma
if (isDead) return;
Vector2 healthBarPos = new Vector2(pos.X - 50, pos.Y - 100.0f);
GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X - 2, (int)healthBarPos.Y - 2, 100 + 4, 15 + 4), Color.Black, false);
GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X, (int)healthBarPos.Y, (int)(100.0f * (health / maxHealth)), 15), Color.Red, true);
Vector2 healthBarPos = new Vector2(pos.X - 50, DrawPosition.Y + 100.0f);
GUI.DrawProgressBar(spriteBatch, healthBarPos, new Vector2(100.0f, 15.0f), health/maxHealth, Color.Lerp(Color.Red, Color.Green, health/maxHealth)*0.8f);
//GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X - 2, (int)healthBarPos.Y - 2, 100 + 4, 15 + 4), Color.Black, false);
//GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X, (int)healthBarPos.Y, (int)(100.0f * (health / maxHealth)), 15), Color.Red, true);
}
public void PlaySound(AIController.AiState state)
@@ -1069,7 +1074,7 @@ namespace Barotrauma
}
}
public void AddDamage(CauseOfDeath causeOfDeath, float amount)
public virtual void AddDamage(CauseOfDeath causeOfDeath, float amount, IDamageable attacker)
{
health = MathHelper.Clamp(health-amount, 0.0f, maxHealth);
if (amount>0.0f) lastAttackCauseOfDeath = causeOfDeath;
@@ -1105,7 +1110,7 @@ namespace Barotrauma
AttackResult attackResult = closestLimb.AddDamage(simPosition, damageType, amount, bleedingAmount, playSound);
AddDamage(damageType == DamageType.Burn ? CauseOfDeath.Burn : causeOfDeath, attackResult.Damage);
AddDamage(damageType == DamageType.Burn ? CauseOfDeath.Burn : causeOfDeath, attackResult.Damage, null);
//health -= attackResult.Damage;
//if (health <= 0.0f && damageType == DamageType.Burn) Kill(CauseOfDeath.Burn);