public void Call() { if (horizontalDirection.IsLeft() && IsInContact(new Vector2[1] { Vector2.left })) { Debug.Log("Call on Left"); box = boxDistance.BoxInContact(new Vector2[1] { Vector2.left }); box.GetComponent <FixedJoint2D>().enabled = true; box.GetComponent <BoxMovement>().isPushed = true; box.GetComponent <FixedJoint2D>().connectedBody = transform.parent.GetComponent <Rigidbody2D>(); } else if (horizontalDirection.IsRight() && IsInContact(new Vector2[1] { Vector2.right })) { Debug.Log("Call on Right"); box = boxDistance.BoxInContact(new Vector2[1] { Vector2.right }); box.GetComponent <BoxMovement>().isPushed = true; box.GetComponent <FixedJoint2D>().enabled = true; box.GetComponent <FixedJoint2D>().connectedBody = transform.parent.GetComponent <Rigidbody2D>(); } else { Debug.Log("Call False"); } }
// Should call specific function depending of the // Movement direction public void StartClimbing() { if (horizontalDirection.IsLeft() && distanceChecker.CheckContactWithWall(new Vector2[1] { Vector2.left })) { SetClimbingStatus(Direction.Left); } else if (horizontalDirection.IsRight() && distanceChecker.CheckContactWithWall(new Vector2[1] { Vector2.right })) { SetClimbingStatus(Direction.Right); } }