public void Reset() { transform.position = Vector3.zero; transform.rotation = Quaternion.identity; m_Bounds.SetMinMax(Vector3.zero, Vector3.zero); Renderer[] renders = PEUtil.GetCmpts <Renderer>(transform); for (int i = 0; i < renders.Length; ++i) { m_Bounds.Encapsulate(renders[i].bounds); } Collider[] colliders = PEUtil.GetCmpts <Collider>(transform); for (int i = 0; i < colliders.Length; ++i) { m_Bounds.Encapsulate(colliders[i].bounds); } ItemDraggingBase draggingBase = GetComponent <ItemDraggingBase>(); if (null != draggingBase) { draggingBase.itemBounds = this; } }
ItemDraggingBase CreateGameObj() { ItemAsset.Drag drag = GetItemDrag(); if (drag == null) { return(null); } GameObject go = drag.CreateDraggingGameObject(null); if (null == go) { return(null); } ItemDraggingBase dragBase = go.GetComponent <ItemDraggingBase>(); if (null == dragBase) { dragBase = go.AddComponent <ItemDraggingArticle>(); //Debug.LogError("drag item has no ItemDraggingBase: " + go.name); //Object.Destroy(go); //return null; } dragBase.itemDragging = drag; go.SetActive(true); return(dragBase); }
void DraggingMgr.IDragable.OnDragOut() { dragBase = CreateGameObj(); if (null == dragBase) { return; } dragBase.OnDragOut(); }