private IEnumerator Routine_Item() { Ray ray; _canSetItem = false; _inOnlyColse = false; //UI外に出るまで待つ while (true) { if (Input.mousePosition.x < _Left.position.x) { _inOnlyColse = true; OnlyClose(); break; } yield return(null); } while (true) { if (Camera.main != null) { ray = Camera.main.ScreenPointToRay(Input.mousePosition); //床のみ if (Physics.Raycast(ray, out _ItemRayCastHit, _MaxDistanceOfItemRayCast, 1 << 12)) { _DragObj.SetActive_CanNotSetImage(false); _canSetItem = true; } else { _DragObj.SetActive_CanNotSetImage(true); _canSetItem = false; } } else { _DragObj.SetActive_CanNotSetImage(true); _canSetItem = false; } if (Input.GetMouseButtonUp(0)) { Debug.Log("Relese"); ReleaseDragObj(_DragObjChild); } yield return(null); } }
public void CreateDragObj(Sprite sprite, int ItemIndex, Main_ItemViewerNode child) { if (_DragObj != null) { Destroy(_DragObj.gameObject); _DragObj = null; _DragObjChild = null; } //if (RoutineItem != null) StopClose //RoutineItem = Routine_Item(); _Audio_ItemCreate.Play(); var obj = Instantiate(_Prefab_ItemDragObj); var component = obj.GetComponent <Main_ItemDragObj>(); component.Init(sprite, ItemIndex); obj.transform.SetParent(_Canvas); _ItemIndex = ItemIndex; _DragObj = component; _DragObj.SetActive_CanNotSetImage(false); _DragObjChild = child; if (_RoutineItem != null) { StopCoroutine(_RoutineItem); } _RoutineItem = Routine_Item(); StartCoroutine(_RoutineItem); }