Пример #1
0
 public virtual void Awake()
 {
     AI      = GetComponent <EnemyBrain>();
     EnemyUI = GetComponent <EnemyUI>();
     EnemyUI.Initialize();
     Health = GetComponent <Health>();
     EnemyUI.UpdateHealthBar(Health);
     Attack = GetComponent <Attack>();
 }
Пример #2
0
 public void GetDamage(int damage)
 {
     if (dontGetDamage == true)
     {
         return;
     }
     currentHealth -= damage;
     if (currentHealth <= 0)
     {
         target.AddEnemyKilled();
         DestroyEnemy();
     }
     enemyUI.UpdateHealthBar(currentHealth, maxHealth);
 }
Пример #3
0
    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);
    }