private void Update() { if (_selectedCard != null) { Vector2 wp = Camera.main.ScreenToWorldPoint(Input.mousePosition); Ray2D ray = new Ray2D(wp, Vector2.zero); RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction); if (hit.collider != null) { var slot = hit.transform.GetComponent <Slot>(); var building = hit.transform.GetComponent <Building>(); if (!slot.isAvailable) { // TODO :: 설치불가마우스 } if (building != null) { // TODO :: Select Card가 BuildCard이면 안됌 if (_selectedCard.GetComponent <BuildCardEffect>() == null) { // TODO :: MouseCursor 변경 } } else if (slot != null) { // TODO :: Select Card가 BuildCard아니면 안됌 if (_selectedCard.GetComponent <BuildCardEffect>() != null) { // TODO :: MouseCursor 변경 } } } } if (Input.GetMouseButtonDown(0)) { Vector2 wp = Camera.main.ScreenToWorldPoint(Input.mousePosition); Ray2D ray = new Ray2D(wp, Vector2.zero); RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction); if (hit.collider != null) { if (_selectedCard != null) { var targetable = hit.transform.GetComponent <Targetable>(); if (targetable != null) { var buildCardEffect = _selectedCard.GetComponent <BuildCardEffect>(); var building = targetable.transform.childCount; var slot = targetable.GetComponent <Slot>(); if (slot != null) { if (!slot.isAvailable) { return; } } if ((building <= 0 && buildCardEffect != null) || (building > 0 && buildCardEffect == null)) { _selectedCard.SetTarget(targetable); _playerHandManagement.ReAssignHands(); _selectedCard.Activate(); _selectedCard.GetComponent <CardUI>().ResetCardClick(true); } } else { _selectedCard.GetComponent <CardUI>().ResetCardClick(); } } } else if (_selectedCard != null) { _selectedCard.GetComponent <CardUI>().ResetCardClick(); } } }