// Unstick from ladder. void Unstick() { player.onLadder = false; ladder = null; snappedToMiddle = false; }
// Stick to ladder. void Stick() { // Put the Ladder class of the ladder in the ladder variable. ladder = hitLadder.GetComponent<Ladder>(); // Make sure the player is considered on a ladder. player.OnLadder(); // If the player is allowed to jump... if (ladder.allowJump) { // ... if the player is allowed to double jump... if (ladder.allowDoubleJump) { // ... reset the amount of jumps that can be performed. player.ResetJumps(); // Or else... } else { // ... set the total jumps allowed to 1. player.SetJumps(1); } // Or else... } else { // ... set the total amount of jumps to 0. player.SetJumps(0); } }