public virtual void Awake() { AI = GetComponent <EnemyBrain>(); EnemyUI = GetComponent <EnemyUI>(); EnemyUI.Initialize(); Health = GetComponent <Health>(); EnemyUI.UpdateHealthBar(Health); Attack = GetComponent <Attack>(); }
public void GetDamage(int damage) { if (dontGetDamage == true) { return; } currentHealth -= damage; if (currentHealth <= 0) { target.AddEnemyKilled(); DestroyEnemy(); } enemyUI.UpdateHealthBar(currentHealth, maxHealth); }
public override int TakeDamage(Vector2Int locationOfAttack, int amount) { int oldHealth = Health.CurrentHealth; Animation.GetHit(locationOfAttack); BattleManager.cardResolveStack.AddDamageDealt(amount); Health.TakeDamage(amount); int damageDealt = oldHealth - Health.CurrentHealth; BattleManager.cardResolveStack.AddDamageDealt(damageDealt); EnemyUI.UpdateHealthBar(Health); if (Health.IsDead) { Eliminate(); // KO'd } else { EnemyUI.FadeHealthBar(); } return(damageDealt); }