예제 #1
0
 public BoobData(BoobData other)
 {
     this.enabled         = other.enabled;
     this.force           = other.force;
     this.gravity         = other.gravity;
     this.originalEnabled = other.originalEnabled;
     this.originalGravity = other.originalGravity;
     this.originalForce   = other.originalForce;
 }
예제 #2
0
        private void SetForce(DynamicBone_Ver02 bone, Vector3 force)
        {
            BoobData data = this.SetDirty(bone);

            if (data.originalForce.hasValue == false)
            {
                data.originalForce = bone.Force;
            }
            data.force = force;
        }
예제 #3
0
        private void SetGravity(DynamicBone_Ver02 bone, Vector3 gravity)
        {
            BoobData data = this.SetDirty(bone);

            if (data.originalGravity.hasValue == false)
            {
                data.originalGravity = bone.Gravity;
            }
            data.gravity = gravity;
        }
예제 #4
0
        private void SetEnabled(DynamicBone_Ver02 bone, bool e)
        {
            BoobData data = this.SetDirty(bone);

            if (data.originalEnabled.hasValue == false)
            {
                data.originalEnabled = bone.enabled;
            }
            data.enabled = e;
        }
예제 #5
0
        private BoobData SetDirty(DynamicBone_Ver02 boob)
        {
            BoobData data;

            if (this._dirtyDynamicBones.TryGetValue(boob, out data) == false)
            {
                data = new BoobData();
                this._dirtyDynamicBones.Add(boob, data);
            }
            return(data);
        }
예제 #6
0
 private void SetNotDirty(DynamicBone_Ver02 boob)
 {
     if (this.IsDirty(boob))
     {
         BoobData data = this._dirtyDynamicBones[boob];
         if (data.originalEnabled.hasValue)
         {
             boob.enabled = data.originalEnabled;
             data.originalEnabled.Reset();
         }
         if (data.originalGravity.hasValue)
         {
             boob.Gravity = data.originalGravity;
             data.originalGravity.Reset();
         }
         if (data.originalForce.hasValue)
         {
             boob.Force = data.originalForce;
             data.originalForce.Reset();
         }
         this._dirtyDynamicBones.Remove(boob);
     }
 }
예제 #7
0
        public override bool LoadXml(XmlNode xmlNode)
        {
            this.SetNotDirty(this._leftBoob);
            this.SetNotDirty(this._rightBoob);


            bool    changed = false;
            XmlNode boobs   = xmlNode.FindChildNode("boobs");

            if (boobs != null)
            {
                if (boobs.Attributes != null && boobs.Attributes["alternativeUpdateMode"] != null)
                {
                    changed = true;
                    this._alternativeUpdateMode = XmlConvert.ToBoolean(boobs.Attributes["alternativeUpdateMode"].Value);
                }
                foreach (XmlNode node in boobs.ChildNodes)
                {
                    try
                    {
                        DynamicBone_Ver02 boob = null;
                        switch (node.Name)
                        {
                        case "left":
                            boob = this._leftBoob;
                            break;

                        case "right":
                            boob = this._rightBoob;
                            break;
                        }

                        if (boob != null)
                        {
                            BoobData data = new BoobData();
                            if (node.Attributes["enabled"] != null)
                            {
                                bool e = XmlConvert.ToBoolean(node.Attributes["enabled"].Value);
                                data.originalEnabled = boob.enabled;
                                data.enabled         = e;
                            }
                            if (node.Attributes["gravityX"] != null && node.Attributes["gravityY"] != null && node.Attributes["gravityZ"] != null)
                            {
                                Vector3 gravity;
                                gravity.x            = XmlConvert.ToSingle(node.Attributes["gravityX"].Value);
                                gravity.y            = XmlConvert.ToSingle(node.Attributes["gravityY"].Value);
                                gravity.z            = XmlConvert.ToSingle(node.Attributes["gravityZ"].Value);
                                data.originalGravity = boob.Gravity;
                                data.gravity         = gravity;
                            }
                            if (node.Attributes["forceX"] != null && node.Attributes["forceY"] != null && node.Attributes["forceZ"] != null)
                            {
                                Vector3 force;
                                force.x            = XmlConvert.ToSingle(node.Attributes["forceX"].Value);
                                force.y            = XmlConvert.ToSingle(node.Attributes["forceY"].Value);
                                force.z            = XmlConvert.ToSingle(node.Attributes["forceZ"].Value);
                                data.originalForce = boob.Force;
                                data.force         = force;
                            }
                            if (data.originalEnabled.hasValue || data.originalGravity.hasValue || data.originalForce.hasValue)
                            {
                                changed = true;
                                this._dirtyDynamicBones.Add(boob, data);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        UnityEngine.Debug.LogError("PHPE: Couldn't load boob for character " + this._parent.name + " " + node.OuterXml + "\n" + e);
                    }
                }
            }
            return(changed);
        }