Пример #1
0
    public void FixedUpdate()
    {
        if (joint == null || NetGame.isClient || ReplayRecorder.isPlaying)
        {
            return;
        }
        Vector3 vector = axis.TransformPoint(Vector3.forward);
        float   num    = (vector - anchor).magnitude - 0.1f;

        if (!(num > 0f))
        {
            return;
        }
        totalTravel += num / (breakAngleTravel * ((float)Math.PI / 180f));
        anchor       = Vector3.MoveTowards(anchor, vector, num);
        if (totalTravel > 1f)
        {
            NetStream netStream = identity.BeginEvent(evtPull);
            identity.EndEvent();
            OnPull(null);
            UnityEngine.Object.Destroy(joint);
            GetComponent <Rigidbody>().angularDrag = 0.05f;
            GetComponent <Rigidbody>().useGravity  = true;
            if (groundedIgnoreCollider != null)
            {
                IgnoreCollision.Unignore(base.transform, groundedIgnoreCollider);
            }
        }
        else
        {
            joint.angularYZDrive = new JointDrive
            {
                positionSpring = 0f,
                positionDamper = holdDamper * (1f - totalTravel),
                maximumForce   = float.PositiveInfinity
            };
        }
    }
Пример #2
0
 private void OnJointBreak(float breakForce)
 {
     IgnoreCollision.Unignore(base.transform, ignoreHat);
 }