public virtual bool TakeDamage(float damage) { health -= damage; healthBar.SetHealth(health / maxHealth); if (health < 0) { Destroy(this.gameObject); return(true); } return(false); }
public bool DamageMob(float damage) { damage *= 1 - reductionPercent; damage -= reductionFlat; float remainder = 0; if (shields > 0) { shields -= damage; damage = 0; } if (shields < 0) { remainder = shields; shields = 0; } if (damage > 0) { health -= damage; } else { health -= remainder; } if (health <= 0) { KillMob(); return(true); } else { healthOrb.SetHealth(health / healthMax); } return(false); }