using System.Collections; using System.Collections.Generic; using UnityEngine; public class Coin : MonoBehaviour, ICollectable { private CoinCounter _coinCounter; private void Awake() { _coinCounter = FindObjectOfType(); } public void Collect() { _coinCounter.CollectCoin(); Destroy(gameObject); } }