void ProcessLeftMouseClick() { if (Input.GetMouseButtonDown(0)) { startClickedPos = Input.mousePosition; //무엇을 클릭했는지 체크 //UI기준좌표계에서 충돌체크. Collider2D temp0 = Physics2D.OverlapPoint(Input.mousePosition); if (temp0 != null) { selectedObject = temp0.gameObject; localOffset = selectedObject.transform.position - Input.mousePosition; isUI = true; } //노드시스템좌표계에서 충돌체크. else { touchPos = nodeCamera.ScreenToWorldPoint(Input.mousePosition); //Switch노드의 AddCase, DeleteCase처리 Collider2D[] temps = Physics2D.OverlapPointAll(touchPos); foreach (Collider2D coll in temps) { if (coll.gameObject.name == "AddStringCase") { coll.gameObject.transform.parent.GetComponent <SwitchOnString>().AddCase(); } if (coll.gameObject.name == "DeleteStringCase") { coll.gameObject.transform.parent.GetComponent <SwitchOnString>().DeleteCase(); } } Collider2D temp = null; Collider2D[] overlapColls = Physics2D.OverlapPointAll(touchPos); //ArrowInput,ArrowOutput 우선처리, 없다면 가장 마지막의 것을 채택 foreach (Collider2D coll in overlapColls) { if (coll.gameObject.name.StartsWith("Input") || coll.gameObject.name.StartsWith("Output") || coll.gameObject.name.EndsWith("(Folder)")) { temp = coll; break; } temp = coll; } if (temp != null && !temp.CompareTag("LockField")) { selectedObject = temp.gameObject; //선택한 오브젝트가 우클릭드래그로 선택한 그룹에 속해있는지 확인 isGroup = false; foreach (GameObject go in selectedObjects) { if (go == selectedObject) { isGroup = true; } } //속해있다면 그 그룹의 localOffset을 구함 if (isGroup) { localOffsets = new Vector3[selectedObjects.Length]; for (int i = 0; i < localOffsets.Length; ++i) { localOffsets[i] = (Vector2)selectedObjects[i].transform.position - touchPos; } } else { localOffset = (Vector2)selectedObject.transform.position - touchPos; } } isUI = false; } Lclicked = true; //클릭시 바로 일어나야 하는 부분 처리. if (selectedObject != null) { Folder folder = selectedObject.GetComponent <Folder>(); TouchEvent touchEvent = selectedObject.GetComponent <TouchEvent>(); if (isGetTool) { if (folder != null) { folder.UnFold(); myAudio.Play(); //myAudio.PlayDelayed(0); isGetTool = false; } } else { if (touchEvent != null) { touchEvent.Active(); } if (folder != null) { folder.Active(); } } } } if (Input.GetMouseButtonUp(0)) { Lclicked = false; if (isGroup) { foreach (GameObject _selectedObject in selectedObjects) { IMovable movable = _selectedObject.GetComponent <IMovable>(); if (movable != null) { if (!isUI) { movable.MoveEnd((nodeCamera.ScreenToWorldPoint(Input.mousePosition) + localOffset), true); } else { movable.MoveEnd(Input.mousePosition + localOffset, true); } } } } else if (selectedObject != null) { IMovable movable = selectedObject.GetComponent <IMovable>(); if (movable != null) { if (!isUI) { movable.MoveEnd((nodeCamera.ScreenToWorldPoint(Input.mousePosition) + localOffset)); } else { movable.MoveEnd(Input.mousePosition + localOffset); } } } selectedObject = null; } //클릭되고있는 동안 else if (Lclicked) { //선택된 오브젝트가 있다면 if (selectedObject != null) { //여러개 선택되었는가 if (isGroup) { for (int i = 0; i < selectedObjects.Length; ++i) { IMovable movable = selectedObjects[i].GetComponent <IMovable>(); if (movable != null) { if (!isUI) { movable.Move((nodeCamera.ScreenToWorldPoint(Input.mousePosition) + localOffsets[i]), true); } else { movable.Move(Input.mousePosition + localOffsets[i], true); } } } } else { IMovable movable = selectedObject.GetComponent <IMovable>(); if (movable != null) { if (!isUI) { movable.Move((nodeCamera.ScreenToWorldPoint(Input.mousePosition) + localOffset)); } else { movable.Move(Input.mousePosition + localOffset); } } } } else { ResetMultySelectSystems(); //화면이동 if (Input.GetMouseButton(0)) { Vector2 delta = (Vector2)Input.mousePosition - startClickedPos; nodeCamera.transform.position -= new Vector3(delta.x, delta.y) * cameraMoveSpeed * Time.deltaTime * nodeCamera.orthographicSize; } } } if (Application.isFocused) { startClickedPos = Input.mousePosition; } }