public void UpdateAttachMent() { if (mVisual != null && mVisual.Visual != null) { for (uint i = 0; i < (uint)AttachMountType.AttachCount; ++i) { AttachMent attach = mAttachMents[i]; if (attach == null || attach.parent != null) { continue; } //挂接 if (mVisual != null && attach.visual != null && attach.visual.Visual != null) { Transform t = mVisual.GetBoneByName(attach.socketname); if (t == null) { t = mVisual.VisualTransform; } attach.parent = t.gameObject; attach.visual.Layer = layermask; DressingRoom.AttachObjectTo(t, attach.visual.VisualTransform, attach.transform); if (i == (uint)AttachMountType.Weapon) { OnWeaponSuccess(); } else if (i == (uint)AttachMountType.Wing) { OnWingSuccess(); } } } } }
//-------------------------------------------------- public void UpdateAttachMent() { if (mVisual != null && mVisual.Visual != null && InitModelID == mModelResID) { for (uint i = 0; i < (uint)AttachMountType.AttachCount; ++i) { AttachMent attach = mAttachMents[i]; if (attach == null || attach.parent != null) { continue; } //挂接 if (mVisual != null && attach.visual != null && attach.visual.Visual != null) { Transform t = mVisual.GetBoneByName(attach.socketname); if (t == null) { t = mVisual.VisualTransform; } attach.parent = t.gameObject; attach.visual.Visual.SetActive(true); DressingRoom.AttachObjectTo(t, attach.visual.VisualTransform, attach.transform); } } } }
/// <summary> /// 挂接一个显示对象 /// </summary> protected AttachMent AttachVisual(PrimitiveVisual visual, string socketname, TransformData trans) { AttachMent attach = new AttachMent(); attach.socketname = socketname; attach.transform = trans; attach.visual = visual; Transform bone = mVisual.GetBoneByName(attach.socketname); if (bone == null) { bone = mVisual.VisualTransform; } DressingRoom.AttachObjectTo(bone, attach.visual.VisualTransform, attach.transform); // BehaviourUtil.StartCoroutine(WaitForAttachComplete(attach)); return(attach); }