void Update() { if (Input.GetMouseButtonDown(0) && !inventory.activeSelf) { mousePosition = Input.mousePosition; mousePosition = Camera.ScreenToWorldPoint(mousePosition); RaycastHit2D hit = Physics2D.Raycast(mousePosition, transform.forward, maxDistance); Debug.Log(hit.collider.gameObject.name); if (hit.collider == null) { } else if (hit.collider.gameObject != tapzone) { if (hit.collider.gameObject.transform.parent.name == farmObjects.name && arrangeImage.transform.position.x < -23) { FarmObjectController farmObjectController = hit.collider.gameObject.GetComponent <FarmObjectController>(); if (farmObjectController.state == FarmObjectController.State.producing && map.activeSelf == false) { tapObject = hit.collider.gameObject; putInvenButton.SetActive(true); offPutInvenButton.SetActive(true); farmObjectNumber = hit.collider.gameObject.GetComponent <FarmObject>().farmObjectNumber; farmObjectIndex = hit.collider.gameObject.GetComponent <FarmObject>().farmObjectIndex; } farmObjectController.Harvest(); } } else if (hit.collider.gameObject.name != putInvenButton.name) { MoneyManager.MoneyUP(oneTapMoney); if (arrangeImage.transform.position.x > -22 && arrangeImage.transform.position.x < 22 && arrangeImage.transform.position.y > -7 && arrangeImage.transform.position.y < 10 && mousePosition.x > -22 && mousePosition.x < 22 && mousePosition.y > -7 && mousePosition.y < 10) { Debug.Log("왜죠"); Drag drag = arrangeImage.GetComponent <Drag>(); drag.ChangePos(mousePosition.x, mousePosition.y); } } } }