public void TakeDamage(int val, Vector2 position) { if (isAlive) { health -= val; spellsManager.CancelMeleeSpells(); pAnim.ReceiveHit(); visual.ReceiveHit(); if (health <= 0) { isAlive = !isAlive; movement.SetActive(false); attack.SetActive(false); deathParticles.Play(); visual.SetPlayerDead(true); pAnim.ResetAnimations(); GameManager.Instance.PlayerDeath(this); } } health = Mathf.Clamp(health, 0, maxHealth); }