/// <summary> /// Detaches from the anchor point /// </summary> public void Detach() { RopeAnchorPoint = null; // invoke the OnGrappleDisconnect events if the reference was not null LastAnchorPointController?.OnGrappleDisconnect.Invoke(); // then null out the reference to the controller LastAnchorPointController = null; RopeLineRenderer.enabled = false; RopeDistanceJoint.enabled = false; RopeAndHookCollider.enabled = false; IsCasting = false; CurrentCastDistance = 0; // invoke the handler for the grapple point being released, unsure if it will block or not, so do this last OnPlayerGrappleRelease.Invoke(); }
/// <summary> /// attaches to the given anchor point /// </summary> /// <param name="point">the rigid body of the point that is being attached to</param> /// <param name="pointController">The GrapplePointController whose methods will be invoked</param> public void Attach(Rigidbody2D point, GrapplePointController pointController) { RopeAnchorPoint = point; LastAnchorPointController = pointController; // invoke the OnGrappleConnect events if a connection is made LastAnchorPointController?.OnGrappleConnect.Invoke(); // use the min cast distance, or the current - the reel in // only if the player is on the ground if (PlayerControllerScript.IsOnGround) { HasDoneInitialReelIn = false; } RopeAndHookCollider.enabled = false; }