public void DeactiveAttachObject(GameObject go) { AttachPointInfo attachPointInfo = null; if (!_mAttachPointInfoList.TryGetValue(go.GetInstanceID(), out attachPointInfo)) { return; } attachPointInfo.MAttachGameObject.SetActiveRecursively(false); }
public bool GetAttachPointInfo(GameObject go, out AttachPointInfo attachPointInfo) { attachPointInfo = null; if (!_mAttachPointInfoList.TryGetValue(go.GetInstanceID(), out attachPointInfo)) { return(false); } return(true); }
public void DetachObject(GameObject go) { AttachPointInfo attachPoint = null; if (!_mAttachPointInfoList.TryGetValue(go.GetInstanceID(), out attachPoint)) { return; } _mAttachPointInfoList.Remove(go.GetInstanceID()); attachPoint.MParentGameObject = null; attachPoint.MAttachGameObject.transform.parent = null; GameObject.DestroyObject(attachPoint.MAttachGameObject); }
public GameObject AttachObject(Object ob, Vector3 relPosition, Quaternion relRotation) { GameObject go = GameObject.Instantiate(ob, relPosition, relRotation) as GameObject; GameObject.DontDestroyOnLoad(go); AttachPointInfo attachPoint = new AttachPointInfo(); attachPoint.MParentGameObject = this.MParentGameObject; attachPoint.MAttachGameObject = go; attachPoint.MAttachPosition = relPosition; attachPoint.MAttachRotation = relRotation; attachPoint.MAttachGameObject.transform.parent = attachPoint.MParentGameObject.transform; attachPoint.MAttachGameObject.transform.localPosition = relPosition; attachPoint.MAttachGameObject.transform.localRotation = relRotation; _mAttachPointInfoList.Add(go.GetInstanceID(), attachPoint); return(go); }
public GameObject AttachObject(GameObject go, Vector3 relPosition, Quaternion relRotation) { if (_mAttachPointInfoList.ContainsKey(go.GetInstanceID())) { return(null); } AttachPointInfo attachPoint = new AttachPointInfo(); attachPoint.MParentGameObject = this.MParentGameObject; attachPoint.MAttachGameObject = go; attachPoint.MAttachPosition = relPosition; attachPoint.MAttachRotation = relRotation; attachPoint.MAttachGameObject.transform.parent = attachPoint.MParentGameObject.transform; attachPoint.MAttachGameObject.transform.localPosition = relPosition; attachPoint.MAttachGameObject.transform.localRotation = relRotation; _mAttachPointInfoList.Add(go.GetInstanceID(), attachPoint); return(go); }