コード例 #1
0
        /// <summary>
        /// 클릭한 오브젝트 가져오기
        /// </summary>
        //GameObject Targeting()
        //{
        //    // 클릭 체크
        //    if (!Input.GetMouseButtonUp(0))
        //        return null;

        //    // UI 클릭 예외처리
        //    if (EventSystem.current.currentSelectedGameObject != null)
        //        return null;


        //    RaycastHit hit = new RaycastHit();
        //    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        //    GameObject clickObj = null;

        //    if (Physics.Raycast(ray.origin, ray.direction, out hit))
        //    {
        //        clickObj = hit.transform.gameObject;
        //        Debug.Log(clickObj.name);
        //    }

        //    return clickObj;
        //}


        /// <summary>
        /// 타겟 정보 새로고침
        /// </summary>
        /// <param name="obj">클릭한 블록 오브젝트</param>
        void RefreshTarget(GameObject obj)
        {
            // 오브젝트가 아닐 경우
            if (obj == null)
            {
                return;
            }

            // 대상이 블록이 아닐경우
            if (blockManager.CheckObjectList(obj))
            {
                target = obj;
            }
            else
            {
                target = null;
            }


            // 텍스트 변경
            if (target == null)
            {
                targetName.text = "is not block";
                return;
            }
            else
            {
                targetName.text = target.name;
            }
        }