using System; using UnityEngine; public class LuckyGameCupCounter : MonoBehaviour { public int objectCount = 0; Action m_actcount; public void Set(Action actcount) { m_actcount = actcount; } void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("LuckyGameObj")) // 오브젝트에 Tag 지정 { objectCount++; m_actcount(objectCount); } } void OnTriggerExit2D(Collider2D other) { if (other.CompareTag("LuckyGameObj")) { objectCount--; m_actcount(objectCount); } } }