Beispiel #1
0
        public static List <Limb> AttachHuskAppendage(Character character, Ragdoll ragdoll = null)
        {
            var       huskDoc         = XMLExtensions.TryLoadXml(Character.GetConfigFile("humanhusk"));
            string    pathToAppendage = huskDoc.Root.Element("huskappendage").GetAttributeString("path", string.Empty);
            XDocument doc             = XMLExtensions.TryLoadXml(pathToAppendage);

            if (doc == null || doc.Root == null)
            {
                return(null);
            }
            if (ragdoll == null)
            {
                ragdoll = character.AnimController;
            }
            if (ragdoll.Dir < 1.0f)
            {
                ragdoll.Flip();
            }
            var huskAppendages = new List <Limb>();
            var limbElements   = doc.Root.Elements("limb").ToDictionary(e => e.GetAttributeString("id", null), e => e);

            foreach (var jointElement in doc.Root.Elements("joint"))
            {
                if (limbElements.TryGetValue(jointElement.GetAttributeString("limb2", null), out XElement limbElement))
                {
                    JointParams jointParams   = new JointParams(jointElement, ragdoll.RagdollParams);
                    Limb        attachLimb    = ragdoll.Limbs[jointParams.Limb1];
                    Limb        huskAppendage = new Limb(ragdoll, character, new LimbParams(limbElement, ragdoll.RagdollParams));
                    huskAppendage.body.Submarine = character.Submarine;
                    huskAppendage.body.SetTransform(attachLimb.SimPosition, attachLimb.Rotation);
                    ragdoll.AddLimb(huskAppendage);
                    ragdoll.AddJoint(jointParams);
                    huskAppendages.Add(huskAppendage);
                }
            }
            return(huskAppendages);
        }
Beispiel #2
0
 public LimbJoint(Limb limbA, Limb limbB, JointParams jointParams, Ragdoll ragdoll) : this(limbA, limbB, Vector2.One, Vector2.One)
 {
     this.jointParams = jointParams;
     this.ragdoll     = ragdoll;
     LoadParams();
 }