public void TakeDamage(int dmg) { if (isAlive && !invincibleNow) { int damageToApply = (int)(dmg / 100f * EverythingLoader.Instance.gameManager.unlockedSkillsList[2]); Debug.Log("damageToApply: " + damageToApply); damagePopup.DamagePop(dmg); playerStats.CurrentHealth -= dmg - damageToApply; playerSrite.GetComponent <SpriteAnims>().FlashRed(); CalculateHealth(); if (playerStats.CurrentHealth <= 0) { playerStats.CurrentHealth = 0; CalculateHealth(); playerSrite.GetComponent <SpriteAnims>().FlashRed(3, transform.position.x, transform.position.y); isAlive = false; canMove = false; canShoot = false; Debug.Log("PLAYER DEAD =( "); } } }
public void TakeDamage(int dmg) { Debug.Log("dmg: " + dmg); currentHp = currentHp - dmg; if (dmg > 0) { //enemySprite.GetComponent<SpriteAnims>().ShowDamgeAmount(dmg); enemySprite.GetComponent <SpriteAnims>().FlashRed(0, 0, 0); damagePopup.DamagePop(dmg); } healthSlider.value = currentHp / (float)enemyStats.MaxHealth; if (currentHp <= 0) { isAlive = false; DropStuff(); ShowDeath(); levelManager.RemoveEnemy(this); //DoDeathAction(this.transform); } }