private void OnCollisionEnter(Collision collision) { HP heelabe = collision.transform.GetComponent <HP>(); if (heelabe != null) { HP.heel = heeling; heelabe.Heel(); } Destroy(gameObject); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Player")) { HP playerHP = other.GetComponent <HP>(); if (playerHP?.GetHP() == 100f) { return; } playerHP.Heel(_heel); Debug.Log("Play audio"); _audio.Play(); gameObject.SetActive(false); } }