123456789101112131415161718192021222324252627282930313233 |
- 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<FarmManager>().ShowPopUp(this);
- }
- }
- private void OnTriggerExit2D(Collider2D other) {
- if(other.tag == "Player"){
- //
- Debug.Log("GameObject : " + gameObject);
- Debug.Log("active item : "+ other.GetComponent<FarmManager>().activeItem);
-
- if(other.GetComponent<FarmManager>().activeItem.gameObject == gameObject){
- other.GetComponent<FarmManager>().HidePopUp();
- Debug.Log("**** player exit from farm item ! ****");
- }
- }
- }
- public void Farm(){
- isAvailable = false;
- }
- }
|