public void ConnectTo(Membrane newNext) { Assert.IsNull(newNext.prev); Assert.IsNull(nextJoint); nextJoint = JointWrapper.MakeJoint(this, newNext); Assert.IsNotNull(nextJoint); }
public virtual void OnCellPartEnterNearby(SimplePart cp) { if (Distance(cp) < CellPartBalance.i.springMaxDist && cp.transform.parent == transform.parent) { JointWrapper.MakeJoint(this, cp); } }
public override void OnConnectedTo(JointWrapper joint) { if (joint.GetSource() is Membrane m) { Assert.IsNull(prev, "Unexpected joint connection"); prev = m; } }
public override void ConfigureJointConstants(JointWrapper wrap) { base.ConfigureJointConstants(wrap); var joint = wrap.GetOrMakeJoint <SpringJoint2D>(); joint.frequency = MembraneBalance.i.immediateSpringFreq; joint.breakForce = MembraneBalance.i.immediateSpringBreakForce; }
public override void OnUnownedJointBroke(JointWrapper joint) { if (joint.GetSource() is Membrane m) { Assert.AreEqual(m, prev, "Unexpected joint connection broke"); prev = null; } }
public override void ConfigureJointConstants(JointWrapper wrap) { SpringJoint2D sticky = wrap.GetOrMakeJoint <SpringJoint2D>(); sticky.distance = .5f; sticky.frequency = 2; sticky.breakForce = 100; sticky.enableCollision = true; stickyJoints.Add(wrap); }
public virtual void ConfigureJointConstants(JointWrapper wrap) { var joint = wrap.GetOrMakeJoint <SpringJoint2D>(); joint.distance = wrap.GetSource().GetNearbyRadius() + wrap.GetConnected().GetRadius() - .2f; joint.frequency = CellPartBalance.i.springFreq; joint.breakForce = CellPartBalance.i.springBreakForce; joint.autoConfigureDistance = false; joint.enableCollision = true; }
public override void OnOwnedJointBroke(JointWrapper joint) { if (joint.GetConnected() is Membrane m) { Assert.AreEqual(joint, nextJoint); // This is not technically necessary, but it makes this field show // up as "null" rather than "missing" while in the editor nextJoint = null; } }
public override void ConfigureJointConstants(JointWrapper wrap) { var joint = wrap.GetOrMakeJoint <FixedJoint2D>(); //joint.autoConfigureOffset = false; //joint.maxForce = 100; joint.frequency = 2; joint.autoConfigureConnectedAnchor = false; joint.breakTorque = 100; joint.breakForce = 100; joint.enableCollision = true; }
IEnumerator DragCoroutine() { while (Mouse.RightMouse()) { yield return(null); } Debug.Log("Mouse released"); if (Mouse.currentlyOver != null) { JointWrapper.MakeJoint(this, Mouse.currentlyOver); } }
public override void OnCellPartEnterNearby(SimplePart cp) { JointWrapper.MakeJoint(this, cp); }
public virtual void OnConnectedTo(JointWrapper joint) { // TODO: Keep track of all connected cells }
// Called on the other end of the joint when a joint breaks public virtual void OnUnownedJointBroke(JointWrapper joint) { }
public void CopyFrom(JointWrapper sourceJointWrapper) { IsActive = sourceJointWrapper.IsActive; Orientation = sourceJointWrapper.Orientation; Tolerance = sourceJointWrapper.Tolerance; }