Example #1
0
    public void attackEnemy(Attack attack, float multiplier)
    {
        currentEnemyHealth -= (int)(attack.enemyDamage * multiplier);
        health.updateHealth(enemy.health, currentEnemyHealth);

        if (currentEnemyHealth <= 0)
        {
            FindObjectOfType <CombatDisplay>().playerVictory();
        }
    }
Example #2
0
 public void updateHealth(int diff)
 {
     health += diff;
     health  = Mathf.Min(health, maxHealth);
     if (health <= 0)
     {
         GameManager.instance.gameOver(false);
     }
     healthDisplay.updateHealth(maxHealth, health);
 }