public void InitDefaultHead() { smrFace = defFace.GetComponent <SkinnedMeshRenderer>(); smrFace.enabled = true; FacialExpressor component = GetComponent <FacialExpressor>(); if (null != component) { component.ChangeFace(smrFace, "default"); } smrHead = defHead.GetComponent <SkinnedMeshRenderer>(); smrHead.enabled = true; smrHead.material = defHeadMat; }
private void ChangeHead(string itemCode) { TCharacter tCharacter = TItemManager.Instance.Get <TCharacter>(itemCode); if (tCharacter != null) { if (testGender) { MyInfoManager.Instance.charCode = itemCode; } if (BuildOption.Instance.IsNetmarble || BuildOption.Instance.IsDeveloper) { if (itemCode == "c17") { IsYang = true; } else { IsYang = false; } } else { IsYang = false; } SkinnedMeshRenderer x = null; SkinnedMeshRenderer skinnedMeshRenderer = null; string b = tCharacter.prefix + "face"; string b2 = tCharacter.prefix + "head"; SkinnedMeshRenderer[] componentsInChildren = GetComponentsInChildren <SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer skinnedMeshRenderer2 in componentsInChildren) { if (skinnedMeshRenderer2.name == b) { x = skinnedMeshRenderer2; } if (skinnedMeshRenderer2.name == b2) { skinnedMeshRenderer = skinnedMeshRenderer2; if (tCharacter.mainMat != null) { skinnedMeshRenderer.material = tCharacter.mainMat; } } } if (x != null && skinnedMeshRenderer != null) { string b3 = gender; gender = tCharacter.gender; smrFace.enabled = false; smrFace = x; smrFace.enabled = true; FacialExpressor component = GetComponent <FacialExpressor>(); if (null != component) { component.ChangeFace(smrFace,tCharacter.prefix); } smrHead.enabled = false; smrHead = skinnedMeshRenderer; smrHead.enabled = true; if (gender != b3) { if (gender == "m_") { for (int j = 0; j < manBody.Length; j++) { looks[j].enabled = false; looks[j] = manBody[j].GetComponent <SkinnedMeshRenderer>(); looks[j].enabled = true; looks[j].material = skins[j]; } } else { for (int k = 0; k < womanBody.Length; k++) { looks[k].enabled = false; looks[k] = womanBody[k].GetComponent <SkinnedMeshRenderer>(); looks[k].enabled = true; looks[k].material = skins[k]; } } } } } }