Connects two Rigidbody2D together at their anchor points using a configurable spring.
static public int get_frequency(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.FixedJoint2D self = (UnityEngine.FixedJoint2D)checkSelf(l); pushValue(l, true); pushValue(l, self.frequency); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
static void FixedJoint2D_referenceAngle(JSVCall vc) { UnityEngine.FixedJoint2D _this = (UnityEngine.FixedJoint2D)vc.csObj; var result = _this.referenceAngle; JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result)); }
static public int constructor(IntPtr l) { try { UnityEngine.FixedJoint2D o; o=new UnityEngine.FixedJoint2D(); pushValue(l,true); pushValue(l,o); return 2; } catch(Exception e) { return error(l,e); } }
static public int get_referenceAngle(IntPtr l) { try { UnityEngine.FixedJoint2D self = (UnityEngine.FixedJoint2D)checkSelf(l); pushValue(l, true); pushValue(l, self.referenceAngle); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_dampingRatio(IntPtr l) { try { UnityEngine.FixedJoint2D self = (UnityEngine.FixedJoint2D)checkSelf(l); pushValue(l, true); pushValue(l, self.dampingRatio); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { UnityEngine.FixedJoint2D o; o = new UnityEngine.FixedJoint2D(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int set_frequency(IntPtr l) { try { UnityEngine.FixedJoint2D self = (UnityEngine.FixedJoint2D)checkSelf(l); float v; checkType(l, 2, out v); self.frequency = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static void FixedJoint2D_frequency(JSVCall vc) { if (vc.bGet) { UnityEngine.FixedJoint2D _this = (UnityEngine.FixedJoint2D)vc.csObj; var result = _this.frequency; JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result)); } else { System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg); UnityEngine.FixedJoint2D _this = (UnityEngine.FixedJoint2D)vc.csObj; _this.frequency = arg0; } }
/// <summary> /// Write the specified value using the writer. /// </summary> /// <param name="value">Value.</param> /// <param name="writer">Writer.</param> public override void Write(object value, ISaveGameWriter writer) { UnityEngine.FixedJoint2D fixedJoint2D = (UnityEngine.FixedJoint2D)value; writer.WriteProperty("dampingRatio", fixedJoint2D.dampingRatio); writer.WriteProperty("frequency", fixedJoint2D.frequency); writer.WriteProperty("anchor", fixedJoint2D.anchor); writer.WriteProperty("connectedAnchor", fixedJoint2D.connectedAnchor); writer.WriteProperty("autoConfigureConnectedAnchor", fixedJoint2D.autoConfigureConnectedAnchor); writer.WriteProperty("connectedBody", fixedJoint2D.connectedBody); writer.WriteProperty("enableCollision", fixedJoint2D.enableCollision); writer.WriteProperty("breakForce", fixedJoint2D.breakForce); writer.WriteProperty("breakTorque", fixedJoint2D.breakTorque); writer.WriteProperty("enabled", fixedJoint2D.enabled); writer.WriteProperty("tag", fixedJoint2D.tag); writer.WriteProperty("name", fixedJoint2D.name); writer.WriteProperty("hideFlags", fixedJoint2D.hideFlags); }
// Use this for initialization void Awake() { transform = GetComponent<Transform>(); anim = GetComponentInChildren<Animator>(); joints = new List<Joint2D>(); rigidbodies = new List<Rigidbody2D>(); jnt_body = body.GetComponent<FixedJoint2D>(); joints.Add(jnt_head = head.GetComponent<HingeJoint2D>()); joints.Add(jnt_armLeftTop = armLeftTop.GetComponent<HingeJoint2D>()); joints.Add(jnt_armLeftBottom = armLeftBottom.GetComponent<HingeJoint2D>()); joints.Add(jnt_handLeft = handLeft.GetComponent<HingeJoint2D>()); joints.Add(jnt_armRightTop = armRightTop.GetComponent<HingeJoint2D>()); joints.Add(jnt_armRightBottom = armRightBottom.GetComponent<HingeJoint2D>()); joints.Add(jnt_handRight = handRight.GetComponent<HingeJoint2D>()); joints.Add(jnt_legLeftTop = legLeftTop.GetComponent<HingeJoint2D>()); joints.Add(jnt_legLeftBottom = legLeftBottom.GetComponent<HingeJoint2D>()); joints.Add(jnt_footLeft = footLeft.GetComponent<HingeJoint2D>()); joints.Add(jnt_legRightTop = legRightTop.GetComponent<HingeJoint2D>()); joints.Add(jnt_legRightBottom = legRightBottom.GetComponent<HingeJoint2D>()); joints.Add(jnt_footRight = footRight.GetComponent<HingeJoint2D>()); rigidbodies.Add(rb_body = body.GetComponent<Rigidbody2D>()); rigidbodies.Add(rb_head = head.GetComponent<Rigidbody2D>()); rigidbodies.Add(rb_armLeftTop = armLeftTop.GetComponent<Rigidbody2D>()); rigidbodies.Add(rb_armLeftBottom = armLeftBottom.GetComponent<Rigidbody2D>()); rigidbodies.Add(rb_handLeft = handLeft.GetComponent<Rigidbody2D>()); rigidbodies.Add(rb_armRightTop = armRightTop.GetComponent<Rigidbody2D>()); rigidbodies.Add(rb_armRightBottom = armRightBottom.GetComponent<Rigidbody2D>()); rigidbodies.Add(rb_handRight = handRight.GetComponent<Rigidbody2D>()); rigidbodies.Add(rb_legLeftTop = legLeftTop.GetComponent<Rigidbody2D>()); rigidbodies.Add(rb_legLeftBottom = legLeftBottom.GetComponent<Rigidbody2D>()); rigidbodies.Add(rb_footLeft = footLeft.GetComponent<Rigidbody2D>()); rigidbodies.Add(rb_legRightTop = legRightTop.GetComponent<Rigidbody2D>()); rigidbodies.Add(rb_legRightBottom = legRightBottom.GetComponent<Rigidbody2D>()); rigidbodies.Add(rb_footRight = footRight.GetComponent<Rigidbody2D>()); }
/// <summary> /// Read the data into the specified value. /// </summary> /// <param name="value">Value.</param> /// <param name="reader">Reader.</param> public override void ReadInto(object value, ISaveGameReader reader) { UnityEngine.FixedJoint2D fixedJoint2D = (UnityEngine.FixedJoint2D)value; foreach (string property in reader.Properties) { switch (property) { case "dampingRatio": fixedJoint2D.dampingRatio = reader.ReadProperty <System.Single> (); break; case "frequency": fixedJoint2D.frequency = reader.ReadProperty <System.Single> (); break; case "anchor": fixedJoint2D.anchor = reader.ReadProperty <UnityEngine.Vector2> (); break; case "connectedAnchor": fixedJoint2D.connectedAnchor = reader.ReadProperty <UnityEngine.Vector2> (); break; case "autoConfigureConnectedAnchor": fixedJoint2D.autoConfigureConnectedAnchor = reader.ReadProperty <System.Boolean> (); break; case "connectedBody": if (fixedJoint2D.connectedBody == null) { fixedJoint2D.connectedBody = reader.ReadProperty <UnityEngine.Rigidbody2D> (); } else { reader.ReadIntoProperty <UnityEngine.Rigidbody2D> (fixedJoint2D.connectedBody); } break; case "enableCollision": fixedJoint2D.enableCollision = reader.ReadProperty <System.Boolean> (); break; case "breakForce": fixedJoint2D.breakForce = reader.ReadProperty <System.Single> (); break; case "breakTorque": fixedJoint2D.breakTorque = reader.ReadProperty <System.Single> (); break; case "enabled": fixedJoint2D.enabled = reader.ReadProperty <System.Boolean> (); break; case "tag": fixedJoint2D.tag = reader.ReadProperty <System.String> (); break; case "name": fixedJoint2D.name = reader.ReadProperty <System.String> (); break; case "hideFlags": fixedJoint2D.hideFlags = reader.ReadProperty <UnityEngine.HideFlags> (); break; } } }
/// <summary> /// Read the data using the reader. /// </summary> /// <param name="reader">Reader.</param> public override object Read(ISaveGameReader reader) { UnityEngine.FixedJoint2D fixedJoint2D = SaveGameType.CreateComponent <UnityEngine.FixedJoint2D> (); ReadInto(fixedJoint2D, reader); return(fixedJoint2D); }
// METHODS public void Awake() { _rigidbody = GetComponent<Rigidbody2D>(); _joint = GetComponent<FixedJoint2D>(); _rigidbody.AddForce(transform.rotation * new Vector2(_forceAmount, 0), ForceMode2D.Impulse); }