Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class CoinPickup : MonoBehaviour
- {
- public int coinValue;
- public AudioSource coinPickupSound;
- void OnTriggerEnter2D(Collider2D other)
- {
- if (other.CompareTag("Player")) // Check if the colliding object is tagged as "Player"
- {
- ScoreManager.AddPoints(coinValue);
- coinPickupSound.Play();
- Destroy(gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement