public void TakeDamage(int damage) { health -= damage; healthBar.ApplyDamge(damage); if (health <= 0) { OnDeath?.Invoke(); int scene = SceneManager.GetActiveScene().buildIndex; SceneManager.LoadScene(scene); } }
public void TakeDamage(int damage) // should be interface(player and enemy) { currentHealth -= damage; healthBar.ApplyDamge(damage); if (currentHealth <= 0) { CurrentSnapPoint.IsFree = true; OnDeath.Invoke(); OnDeatForQuest.Invoke(preset.name); Destroy(gameObject); } }