コード例 #1
0
 public void Reset()
 {
     if (TempGameObject != null)
     {
         GameObject.DestroyImmediate(TempGameObject);
     }
     AttachmentPair = null;
 }
コード例 #2
0
ファイル: F3DMeshBody.cs プロジェクト: YYCatKnight/DieWorld
        public void ChangeAttachment(string partName, string sourceName)
        {
            AttachmentPair ap = new AttachmentPair();

            ap.partName   = partName;
            ap.sourceName = sourceName;
            ChangeAttachment(ap);
            ApplyAttachments();
        }
コード例 #3
0
        public void ChangeAttachment(string partName, string sourceName, bool isUpdate = true)
        {
            AttachmentPair ap = new AttachmentPair();

            ap.partName   = partName;
            ap.sourceName = sourceName;
            ChangeAttachment(ap);
            if (isUpdate)
            {
                Debug.Log("暂时没有实现");
            }
        }
コード例 #4
0
            public void CreateInitialState(string name)
            {
                if (AttachmentPair != null)
                {
                    Debug.LogError("Attachment pair already created. Make sure to clean any previous state before initializing a new one.", AttachmentPair);
                    return;
                }

                TempGameObject           = new GameObject();
                TempGameObject.hideFlags = HideFlags.HideAndDontSave;
                AttachmentPair           = AttachmentPair.Create(TempGameObject);
                Name = Factory.CreateName(name + "_constraint");
            }
コード例 #5
0
ファイル: F3DMeshBody.cs プロジェクト: YYCatKnight/DieWorld
        private void ChangeAttachment(AttachmentPair part)
        {
            BodyPart   bp         = new BodyPart();
            GameObject partObject = SceneManager.LoadPrefab <GameObject>(part.sourceName);

            SkinnedMeshRenderer[] smrs = partObject.GetComponentsInChildren <SkinnedMeshRenderer>(true);
            for (int i = 0; i < smrs.Length; i++)
            {
                SkinnedMeshRenderer sm = smrs[i];

                //骨骼
                for (int b = 0; b < sm.bones.Length; b++)
                {
                    string    boneName = sm.bones[b].name;
                    Transform bone     = GetBone(boneName);
                    if (bone)
                    {
                        bp.bones.Add(bone);
                    }
                    else
                    {
                        Debug.LogError(part.partName + "部位,切换装备:" + part.sourceName + "没有找到" + boneName + "骨骼");
                    }
                }


                //mesh
                for (int s = 0; s < sm.sharedMesh.subMeshCount; s++)
                {
                    CombineInstance ci = new CombineInstance();
                    ci.mesh         = sm.sharedMesh;
                    ci.subMeshIndex = s;
                    bp.combines.Add(ci);
                }

                //mat
                for (int m = 0; m < sm.sharedMaterials.Length; m++)
                {
                    bp.mats.Add(sm.sharedMaterials[m]);
                }
            }
            mParts[part.partName] = bp;
        }
コード例 #6
0
 public ConstraintAttachmentFrameTool(AttachmentPair attachmentPair, UnityEngine.Object onChangeDirtyTarget = null)
 {
     AttachmentPair      = attachmentPair;
     OnChangeDirtyTarget = onChangeDirtyTarget;
 }
コード例 #7
0
 private void ChangeAttachment(AttachmentPair part)
 {
 }