Esempio n. 1
0
        public void EndInteraction(bool immediately = false)
        {
            if (null != m_CasterInteractionSystem)
            {
                for (int i = 0; i < casterEffectors.Length; i++)
                {
                    if (immediately || !m_CasterInteractionSystem.IsPaused(casterEffectors[i]))
                    {
                        m_CasterInteractionSystem.StopInteraction(casterEffectors[i]);
                    }
                    else
                    {
                        m_CasterInteractionSystem.ResumeInteraction(casterEffectors[i]);
                    }
                }
            }

            if (null != m_TargetInteractionSystem)
            {
                for (int i = 0; i < targetEffectors.Length; i++)
                {
                    if (immediately)
                    {
                        m_TargetInteractionSystem.StopInteraction(targetEffectors[i]);
                    }
                    else
                    {
                        m_TargetInteractionSystem.ResumeInteraction(targetEffectors[i]);
                    }
                }
            }
        }
Esempio n. 2
0
 private void StopTouch(InteractionSystem interactionSystem)
 {
     this.interactionObject.transform.parent = interactionSystem.transform;
     this.nextSwitchTime = Time.time + this.minSwitchTime;
     if (interactionSystem.IsPaused(this.effectorType))
     {
         interactionSystem.ResumeInteraction(this.effectorType);
     }
     else
     {
         this.speedF         = 0f;
         this.targetPosition = this.hit.point;
         this.targetRotation = Quaternion.LookRotation(-this.hit.normal);
     }
 }
Esempio n. 3
0
            // Stop touching the walls
            private void StopTouch(InteractionSystem interactionSystem)
            {
                interactionObject.transform.parent = interactionSystem.transform;
                nextSwitchTime = Time.time + minSwitchTime / interactionSystem.speed;

                if (interactionSystem.IsPaused(effectorType))
                {
                    interactionSystem.ResumeInteraction(effectorType);
                }
                else
                {
                    speedF         = 0f;
                    targetPosition = hit.point;
                    targetRotation = Quaternion.LookRotation(-hit.normal);
                }
            }
Esempio n. 4
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();
    }