internal void Damage(int amoutDamage) { animator.SetTrigger("damage"); if (amoutDamage > 30) { DamagePopup.CreateCritical($"{amoutDamage}", transform.position); } else { DamagePopup.Create($"{amoutDamage}", transform.position); } healthBar.Subtract(amoutDamage / 100.0f); }
void Update() { if (Input.GetMouseButtonDown(0)) { var mouse = Input.mousePosition; var worldPosition = Camera.main.ScreenToWorldPoint(mouse); var damage = Random.Range(0, 100); var isCriticalHit = damage >= 80; if (isCriticalHit) { DamagePopup.CreateCritical(damage.ToString(), worldPosition); } else { DamagePopup.Create(damage.ToString(), worldPosition); } } }