using UnityEngine;

public class Arrow : MonoBehaviour {

    [SerializeField] private float destroyTime = 5f;

    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start() {
        Destroy(this.gameObject, destroyTime);
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Player") {
            collision.gameObject.GetComponent<Player>().TakeDamage(1);
            Destroy(this.gameObject);
        }
    }
}
