Exemplo n.º 1
0
 /// <summary>
 /// Takes the damage.
 /// </summary>
 /// <returns><c>true</c>, if dead, <c>false</c> otherwise.</returns>
 /// <param name="dp">DamagePackage.</param>
 public bool TakeDamage(ref DamagePackage dp)
 {
     dp.DamageIncrease(damageIncrease);
     dp.DamageReduction(damageReduction);
     dp.DamageReduction(additionalReductions);
     health -= (int)Math.Floor(dp.damage);
     Debug.Log("Player took: " + dp.damage + " damage");
     //Updates the healthbar
     CombatText._instance.PlayerTakesDamage((int)Math.Floor(dp.damage), dp.isCrit, false, dp.name, health);
     //VisualController._instance.UpdatePlayerHealthbar (health);
     if (health <= 0)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Takes the damage.
 /// </summary>
 /// <returns><c>true</c>, if dead, <c>false</c> otherwise.</returns>
 /// <param name="dp">DamagePackage</param>
 public bool TakeDamage(ref DamagePackage dp)
 {
     dp.DamageIncrease(damageIncrease);
     dp.DamageReduction(damageReduction);
     dp.DamageReduction(additionalReductions);
     health -= (int)Math.Floor(dp.damage);
     Debug.Log("Enemy took: " + dp.damage + " damage");
     //Update Healthbar
     CombatText._instance.EnemyTakesDamage((int)Math.Floor(dp.damage), dp.isCrit, false, dp.name, health);
     if (health <= 0)
     {
         Player._instance.AddGold(level);
         Player._instance.AddExperience(level);
         return(true);
     }
     return(false);
 }