public bool CanPickup()
 {
     if (interactionSystem.IsInInteraction(FullBodyBipedEffector.RightHand))
     {
         //Debug.LogError("我在动画中不方便拿东西");
         return(false);
     }
     return(true);
 }
Пример #2
0
    void FixedUpdate()
    {
        //update points to attach points
        if (StartAttachPoint != null && EndAttachPoint != null)
        {
            if (EndPoint != null && StartPoint != null)
            {
                StartPoint.position = StartAttachPoint.position;
                EndPoint.position   = EndAttachPoint.position;
            }
            else
            {
//				print ("null 1");
            }
        }
        else
        {
//			print ("null 2");
        }

        //draw rope with line renderer
        drawRope();

        updateCollider();

        _currentRopeDistance = Vector3.Distance(StartPoint.position, EndPoint.position);

        if (!photonView.isMine)
        {
            return;
        }

        //null mean death(destroyed target)?
        if (EndPoint == null || StartPoint == null)
        {
            Destroy();
            return;
        }

        if (StartTarget != null)
        {
            if (StartTarget.GetComponent <CharacterMovementHandler> ())
            {
                _grounded = StartTarget.GetComponent <CharacterMovementHandler> ().IsGrounded;
            }
            else
            {
                _grounded = true;
            }
        }

        if (EndPoint.position.y > StartPoint.position.y + 0.5f)
        {
            _isEndPointHigher = true;
        }
        else
        {
            _isEndPointHigher = false;
        }

        if (_intSys != null)
        {
            if (_grounded)
            {
                _intSys.ResumeInteraction(FullBodyBipedEffector.RightHand);
            }
            else if (_isEndPointHigher && !_intSys.IsInInteraction(FullBodyBipedEffector.RightHand) && !_intSys.IsPaused())
            {
                _intSys.StartInteraction(RootMotion.FinalIK.FullBodyBipedEffector.RightHand, _handGrabTarget, true);
            }
        }
        //update raycasted version of the rope
        if (IsSetup)
        {
            tether();
        }

        //position hand grab target
        _handGrabTarget.transform.position = StartPoint.position + (EndPoint.position - StartPoint.position).normalized * 0.5f;
        _handGrabTarget.transform.LookAt(EndPoint);
        _handGrabTarget.transform.Rotate(new Vector3(90f, 0f, 0f));

//		//draw rope with line renderer
//		drawRope ();

//		updateCollider ();

        checkForBending();
    }