Exemple #1
0
 public void UpdatePull()
 {
     if (HasTarget)
     {
         jointController.UpdateJoint(-pullSpeed * Time.deltaTime);
     }
 }
Exemple #2
0
    public void UpdatePush()
    {
        if (HasTarget)
        {
            //Are we still in range of the point we are pushing away from?
            if (Vector2.Distance(transform.position, jointController.GetGrapplePoint()) < pushDistance)
            {
                //Get the direction of the player from the grapple point
                Vector3 direction = transform.position - jointController.GetGrapplePoint();

                //Apply force to the object in the direction
                forceToApply = true;
                forceAmount  = direction * pushForce * Time.deltaTime;

                jointController.UpdateJoint(pushForce * Time.deltaTime);
            }
            else
            {
                player.DeactivateLineRenderer();
                EndPush();
            }
        }
    }