public void AttackToEnemy(HeroManager enemy, int damage) { hero.AttackAction(); damage = damage - enemy.def; if (damage > 0) { enemy.health -= damage; enemy.Blink(damage); if (enemy.health <= 0) { enemy.isLive = false; } } Debug.Log(hero.gameObject.name + " Attack " + enemy.gameObject.name + "\nDamage : " + damage); }
public void Attack(HeroManager h1, HeroManager h2) { h1.AttackAction(); int damage = h1.atk - h2.def; if (damage > 0) { h2.health -= damage; h2.Blink(damage); if (h2.health <= 0) { h2.isLive = false; } } Debug.Log(h1.gameObject.name + " Attack " + h2.gameObject.name + "\nDamage : " + damage); }