public void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag != "Stairs" || playerController.getIsClimbing()) { return; } GameObject stairs = collision.gameObject; StairController stairController = stairs.GetComponentInParent <StairController>(); leftEndStep = stairController.leftEndStep; rightEndStep = stairController.rightEndStep; stairDirection = stairController.getStairDirection(); float climb = Input.GetAxisRaw("Climb"); if ((climb == 1 || climb == -1) && playerController.getPlayerStairState() != PlayerController.STAIR_STATE.on_stair) { platformerController.enabled = false; playerController.setIsClimbing(true); //Debug.Log("Control taken from platformer controller"); // move player to base of stairs if grounded if (platformerController.GetPlayerGrounded()) { //Debug.Log("Closest End: " + closestEndStep.name); fraction = 0; StartCoroutine(MovePlayerToStairs(player, stairController)); } else { StartCoroutine(SnapPlayerToStairs(player, stairController)); } } }