public void LoadFromNode(LYRagdollManager.ItemD item_, LYRagdollManager.templateItemD template_) { if (item_ == null) { return; } if (item_.root == null) { return; } ragDollItem = item_; templateItem = template_; rootItem = ReadXmlNode(item_.root, null, templateItem); }
protected BoneItemD ReadXmlNode(XmlNode node_, BoneItemD parent_, LYRagdollManager.templateItemD templateItem_) { if (node_ == null) { return(null); } BoneItemD item = new BoneItemD(); item.parent = parent_; item.templateItem = templateItem_; List <float> tempFLst = new List <float>(); for (int i = 0; i < node_.Attributes.Count; i++) { XmlAttribute a = node_.Attributes[i]; if (a.Name == "name") { item.BoneName = a.Value; break; } } item.anchor = gameObject.GetChildTransform(item.BoneName); //if (item.anchor == null) // return null; for (int i = 0; i < node_.Attributes.Count; i++) { XmlAttribute a = node_.Attributes[i]; switch (a.Name) { case "type": item.colliderType = a.Value; break; case "limit": tempFLst = GetFloatLst(a.Value); item.minLimit = tempFLst[0]; item.maxLimit = tempFLst[1]; break; case "swing": item.swingLimit = GetFloatLst(a.Value)[0]; break; case "axis": item.axis = GetDirByType(a.Value); break; case "normalAxis": item.normalAxis = GetDirByType(a.Value); break; case "radiusScale": item.radiusScale = GetFloatLst(a.Value)[0]; break; case "density": item.density = GetFloatLst(a.Value)[0]; break; case "summedMass": item.summedMass = GetFloatLst(a.Value)[0]; break; case "minSize": item.minSize = GetFloatLst(a.Value)[0]; break; case "Encapsulate": if (a.Value == "false") { item.bEncapsulateInParent = false; } break; } } for (int i = 0; i < node_.ChildNodes.Count; i++) { BoneItemD child = ReadXmlNode(node_.ChildNodes[i], item, templateItem_); if (child != null) { item.childLst.Add(child); } } return(item); }