public void WearItem(Item item) { if (item.type == Item.ItemType.Fish || item.type == Item.ItemType.None) { return; } if (item.type == Item.ItemType.Shoe) { Instance.nvAgent.speed = item.data.movementSpeed; } var sameItems = Equipment.Where(x => x.type == item.type); if (sameItems.Count() > 0) { UnwearItem(sameItems.ElementAt(0)); } Equipment.Add(item); if (item.type == Item.ItemType.Rod) { return; } foreach (var child in item.transform.GetComponentsInChildren <Transform>()) { child.gameObject.layer = LayerMask.NameToLayer("Player"); } var reassignWeights = item.rendererGameObject.GetComponent <ReassignBoneWeigthsToNewMesh>(); item.transform.position = transform.position; item.rendererGameObject.transform.parent = transform; if (smCombiner.isMeshesCombined()) { smCombiner.UndoCombineMeshes(true, true); } reassignWeights.newArmature = Instance.armature; reassignWeights.rootBoneName = "Spine1"; reassignWeights.Reassign(); smCombiner.CombineMeshes(); }
void Update() { //Example of API to verify if meshes are merged if (charL.isMeshesCombined() == true) { buttonL.text = "Undo Merge of This Model!"; statusL.text = "<color=green>Meshes Combined</color>"; } else { buttonL.text = "Combine This Model!"; statusL.text = "<color=red>Meshes NOT Combined</color>"; } if (charR.isMeshesCombined() == true) { buttonR.text = "Undo Merge of This Model!"; statusR.text = "<color=green>Meshes Combined</color>"; } else { buttonR.text = "Combine This Model!"; statusR.text = "<color=red>Meshes NOT Combined</color>"; } if (charM.isMeshesCombined() == true) { buttonM.text = "Undo Merge of This Model!"; statusM.text = "<color=green>Meshes Combined</color>"; } else { buttonM.text = "Combine This Model!"; statusM.text = "<color=red>Meshes NOT Combined</color>"; } }
public void MeRg() { if (_Combiner.isMeshesCombined()) { Stopwatch watch = Stopwatch.StartNew(); _Combiner.UndoCombineMeshes(true, false); Debug.Log("Uncombining took: " + watch.ElapsedMilliseconds); } else { Stopwatch watch = Stopwatch.StartNew(); _Combiner.CombineMeshes(); Debug.Log("combining took: " + watch.ElapsedMilliseconds); } }