using UnityEngine;

public class HealthAdder : MonoBehaviour
{

    AudioSource use;

    private void Start()
    {
        use = GetComponent<AudioSource>();
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Player player = collision.GetComponent<Player>();
        if (player != null)
        {
            player.lifes = 3;
            player.UpdateLifeText();
            use.pitch = Random.Range(0.95f, 1.05f);
            use.Play();
        }
    }
}
