// Token: 0x060001C6 RID: 454 RVA: 0x00007A2C File Offset: 0x00005C2C private void CreatedCollider(Collider created, global::AuthorChHit.Rep repFormat, bool addJoints, int?layerIndex) { if (!created) { return; } repFormat.bone = created.transform; if (addJoints) { Rigidbody rigidbody = created.rigidbody; if (!rigidbody) { rigidbody = created.gameObject.AddComponent <Rigidbody>(); } rigidbody.mass = this.mass; rigidbody.drag = this.drag; rigidbody.angularDrag = this.angularDrag; if (this.myJoints != null) { foreach (global::AuthorChJoint authorChJoint in this.myJoints) { if (authorChJoint) { authorChJoint.AddJoint(repFormat.bone.root, ref repFormat); } } } } if (layerIndex != null) { created.gameObject.layer = layerIndex.Value; } }
// Token: 0x060001EB RID: 491 RVA: 0x00008B54 File Offset: 0x00006D54 public override bool OnSceneView() { bool flag = base.OnSceneView(); global::AuthorChHit.Rep primary = this.self.primary; global::AuthorChHit.Rep secondary = this.self.secondary; global::AuthorChHit.Rep rep = default(global::AuthorChHit.Rep); global::AuthorChHit.Rep rep2 = default(global::AuthorChHit.Rep); if (this.connect) { rep = this.connect.primary; rep2 = this.connect.secondary; if (!rep2.valid) { rep2 = rep; } } if (primary.valid) { flag |= this.DoTransformHandles(ref primary, ref rep); } if (secondary.valid) { flag |= this.DoTransformHandles(ref secondary, ref rep2); } return(flag); }
// Token: 0x060001E9 RID: 489 RVA: 0x000087AC File Offset: 0x000069AC public Joint AddJoint(Transform root, ref global::AuthorChHit.Rep self) { Joint result; switch (this.kind) { case global::AuthorChJoint.Kind.Hinge: { HingeJoint hingeJoint = this.CreateJoint <HingeJoint>(root, ref self); hingeJoint.limits = this.limit; hingeJoint.useLimits = this.useLimit; hingeJoint.motor = this.motor; hingeJoint.useMotor = this.useMotor; hingeJoint.spring = this.spring; hingeJoint.useSpring = this.useSpring; result = hingeJoint; break; } case global::AuthorChJoint.Kind.Character: { CharacterJoint characterJoint = this.CreateJoint <CharacterJoint>(root, ref self); characterJoint.swingAxis = self.AxisFlip(this.swingAxis); characterJoint.lowTwistLimit = this.lowTwist; characterJoint.highTwistLimit = this.highTwist; characterJoint.lowTwistLimit = this.lowTwist; characterJoint.swing1Limit = this.swing1; characterJoint.swing2Limit = this.swing2; result = characterJoint; break; } case global::AuthorChJoint.Kind.Fixed: { FixedJoint fixedJoint = this.CreateJoint <FixedJoint>(root, ref self); result = fixedJoint; break; } case global::AuthorChJoint.Kind.Spring: { SpringJoint springJoint = this.CreateJoint <SpringJoint>(root, ref self); springJoint.spring = this.spring_spring; springJoint.damper = this.spring_damper; springJoint.minDistance = this.spring_min; springJoint.maxDistance = this.spring_max; result = springJoint; break; } default: return(null); } return(result); }
// Token: 0x060001E6 RID: 486 RVA: 0x00008668 File Offset: 0x00006868 private void ConfigureJointShared(Joint joint, Transform root, ref global::AuthorChHit.Rep self) { if (this.connect) { global::AuthorChHit.Rep rep; if (self.mirrored) { rep = this.connect.secondary; if (!rep.valid) { rep = this.connect.primary; } } else { rep = this.connect.primary; if (!rep.valid) { rep = this.connect.secondary; } } if (rep.valid) { Transform transform = root.FindChild(rep.path); Rigidbody rigidbody = transform.rigidbody; if (!rigidbody) { rigidbody = transform.gameObject.AddComponent <Rigidbody>(); } joint.connectedBody = rigidbody; } else { Debug.LogWarning("No means of making/getting rigidbody", this.connect); } } joint.anchor = self.Flip(this.anchor); joint.axis = self.AxisFlip(this.axis); joint.breakForce = this.breakForce; joint.breakTorque = this.breakTorque; }
// Token: 0x060001EA RID: 490 RVA: 0x000088F0 File Offset: 0x00006AF0 private bool DoTransformHandles(ref global::AuthorChHit.Rep self, ref global::AuthorChHit.Rep connect) { if (!self.valid) { return(false); } Vector3 v = self.Flip(this.anchor); Vector3 vector = self.AxisFlip(this.axis); Vector3 vector2 = self.AxisFlip(this.swingAxis); Matrix4x4 matrix = global::AuthorShared.Scene.matrix; if (connect.valid) { global::AuthorShared.Scene.matrix = connect.bone.localToWorldMatrix; Color color = global::AuthorShared.Scene.color; global::AuthorShared.Scene.color = color * new Color(1f, 1f, 1f, 0.4f); Vector3 vector3 = connect.bone.InverseTransformPoint(self.bone.position); if (vector3 != Vector3.zero) { global::AuthorShared.Scene.DrawBone(Vector3.zero, Quaternion.LookRotation(vector3), vector3.magnitude, 0.02f, new Vector3(0.05f, 0.05f, 0.5f)); } global::AuthorShared.Scene.color = color; } global::AuthorShared.Scene.matrix = self.bone.localToWorldMatrix; bool result = false; if (global::AuthorShared.Scene.PivotDrag(ref v, ref vector)) { result = true; this.anchor = self.Flip(v); this.axis = self.AxisFlip(vector); } global::AuthorChJoint.Kind kind = this.kind; if (kind != global::AuthorChJoint.Kind.Hinge) { if (kind == global::AuthorChJoint.Kind.Character) { Color color2 = global::AuthorShared.Scene.color; global::AuthorShared.Scene.color = color2 * global::AuthorChJoint.twistColor; SoftJointLimit softJointLimit = this.lowTwist; SoftJointLimit highTwist = this.highTwist; if (global::AuthorShared.Scene.LimitDrag(v, vector, ref this.twistOffset, ref softJointLimit, ref highTwist)) { result = true; this.lowTwist = softJointLimit; this.highTwist = highTwist; } global::AuthorShared.Scene.color = color2 * global::AuthorChJoint.swing1Color; softJointLimit = this.swing1; if (global::AuthorShared.Scene.LimitDrag(v, vector2, ref this.swingOffset1, ref softJointLimit)) { result = true; this.swing1 = softJointLimit; } global::AuthorShared.Scene.color = color2 * global::AuthorChJoint.swing2Color; softJointLimit = this.swing2; if (global::AuthorShared.Scene.LimitDrag(v, Vector3.Cross(vector2, vector), ref this.swingOffset2, ref softJointLimit)) { result = true; this.swing2 = softJointLimit; } global::AuthorShared.Scene.color = color2; } } else if (this.useLimit) { JointLimits limit = this.limit; if (global::AuthorShared.Scene.LimitDrag(v, vector, ref this.limitOffset, ref limit)) { result = true; this.limit = limit; } } global::AuthorShared.Scene.matrix = matrix; return(result); }
// Token: 0x060001E8 RID: 488 RVA: 0x00008784 File Offset: 0x00006984 private TJoint CreateJoint <TJoint>(Transform root, ref global::AuthorChHit.Rep self) where TJoint : Joint { return(this.ConfigJoint <TJoint>(self.bone.gameObject.AddComponent <TJoint>(), root, ref self)); }
// Token: 0x060001E7 RID: 487 RVA: 0x00008770 File Offset: 0x00006970 private TJoint ConfigJoint <TJoint>(TJoint joint, Transform root, ref global::AuthorChHit.Rep self) where TJoint : Joint { this.ConfigureJointShared(joint, root, ref self); return(joint); }