using System.Collections; using System.Collections.Generic; using UnityEngine; public class FarmItem : MonoBehaviour { public string lootDrop; public float farmingTime = 30f; public bool isAvailable = true; private void OnTriggerStay2D(Collider2D other) { if(other.tag == "Player"){ //ui other.GetComponent().ShowPopUp(this); } } private void OnTriggerExit2D(Collider2D other) { if(other.tag == "Player"){ // Debug.Log("GameObject : " + gameObject); Debug.Log("active item : "+ other.GetComponent().activeItem); if(other.GetComponent().activeItem.gameObject == gameObject){ other.GetComponent().HidePopUp(); Debug.Log("**** player exit from farm item ! ****"); } } } public void Farm(){ isAvailable = false; } }