using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Coin : MonoBehaviour
{
    [SerializeField] AudioClip CoinPickupSFX;
    [SerializeField] int pointsForCoinPickup = 100;
    

    private void OnTriggerEnter2D(Collider2D collision)
    {
        FindObjectOfType<trackscore>().AddToScore(pointsForCoinPickup);
        AudioSource.PlayClipAtPoint(CoinPickupSFX, Camera.main.transform.position);
        Destroy(gameObject);
    }


}