IEnumerator ClimbLadder() { PB.StartCoroutine(PB.StunCoroutine(upClimbTime)); Vector3 oPos = Body.position; Vector3 targetMidPos = Vector3.Lerp(oPos, currentLadder.ClimbPosition, 0.5f); Vector3 targetPos = currentLadder.ClimbPosition; float count = 0f; while (count < upClimbTime * 0.5f) { Body.position = Vector3.Lerp(oPos, targetMidPos, Mathf.Pow(count / (upClimbTime * 0.5f), upClimbStartLinearity)); Body.position = Body.position.SetY(Utilities.Lerp(oPos.y, targetPos.y, Mathf.Pow(count / upClimbTime, 0.5f))); yield return(null); count += Time.deltaTime; } count -= upClimbTime * 0.5f; while (count < upClimbTime * 0.5f) { Body.position = Vector3.Lerp(targetMidPos, targetPos, Mathf.Pow(count / (upClimbTime * 0.5f), upClimbEndLinearity)); Body.position = Body.position.SetY(Utilities.Lerp(oPos.y, targetPos.y, Mathf.Pow((count + upClimbTime * 0.5f) / upClimbTime, 0.5f))); yield return(null); count += Time.deltaTime; } Body.position = targetPos; GiveUpLadder(); }