using UnityEngine;

public class setRespawn : MonoBehaviour
{

    [SerializeField] float newRotationSpeed = 0.75f;

    AudioSource use;

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