Сюда надо вернуть значение
void Attack(int Damage, int EXP)
{
//Attack anim
Collider2D[] hitEnemies = Physics2D.OverlapCircleAll(attackPoint.position, attackRange, enemyLayers);
foreach(Collider2D enemy in hitEnemies)
{
enemy.GetComponent<Enemy>().TakeDamage(Damage, EXP);
Debug.Log(EXP);
}
}
От сюда должно вернуться значение
public int TakeDamage(int damage, int EXP)
{
currentHealth -= damage;
//Anim hurt
if(currentHealth <= 0)
{
EXP += 1;
Debug.Log(EXP);
Die();
}
return EXP;
}
void Die()
{
Debug.Log($"Enemy died");
//Die anim
}