// 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);
            }
        }
        // Update is called once per frame.
        void Update()
        {
            // Reset the wallRunning, wallSliding and stuckToWall variables.
            wallRunning = false;
            wallSliding = false;
            stuckToWall = false;

            // Reset the boomerang wall jump when the timer is completed.
            if (boomerangJump)
            {
                if (boomerangTimer > 0)
                {
                    boomerangTimer -= Time.deltaTime;
                }
                else
                {
                    boomerangJump = false;
                }
            }

            // Set runSlowdown and slideSpeedup.
            if (!wallRun.infiniteRun && wallRun.runSlowdown)
            {
                runSlowdown = (Time.deltaTime / wallRun.runTime) * wallRun.runSpeed;
            }
            if (wallSlide.slideSpeedup)
            {
                slideSpeedup = (Time.deltaTime / wallSlide.slideTime) * wallSlide.slideSpeed;
            }

            // If there can be interacted with the wall and the player is allowed to interact...
            if (((jumpToStick && !player.grounded) || (!jumpToStick && !player.crouching)) && (wallJump.enabled || wallRun.enabled || wallSlide.enabled) && !player.onLadder)
            {
                // The player is facing a wall if a linecast between the 'frontCheck' objects hits anything on the wall layer.
                Collider2D hitWall = Physics2D.OverlapArea(player.frontCheckTop.transform.position, player.frontCheckBot.transform.position, wallLayer);
                facingWall = hitWall != null;

                // Set the last wall when not on a wall.
                if (!facingWall && currentWall != 0 && !player.stuckToWall)
                {
                    lastWall    = currentWall;
                    currentWall = 0;
                }

                // Only allow interaction with the wall when player isn't falling.
                if (!player.falling)
                {
                    // If the player is facing a wall...
                    if (facingWall)
                    {
                        // If the player is currently moving towards the wall...
                        if ((player.facingRight && player.hor > 0) || (!player.facingRight && player.hor < 0))
                        {
                            // If not stuck on the wall yet...
                            if (!player.stuckToWall)
                            {
                                // ... disable horizontal movement.
                                player.StuckToWall(true);

                                // Reset the air dash limit.
                                player.ResetAirDashLimit();

                                // Stick the player to the wall, reset the wallStickTimer and wallUnstickTimer.
                                wallStickTimer   = wallJump.wallStickTime;
                                wallUnstickTimer = wallUnstickTime;

                                // Set which wall the player is using.
                                onLeftWall  = !player.facingRight;
                                onRightWall = player.facingRight;

                                // Remember the current wall.
                                currentWall = hitWall.GetInstanceID();

                                // Set jumps to 0 if wall jumping isn't allowed.
                                if (!wallJump.enabled || !CanSameWallJump())
                                {
                                    player.SetJumps(0);
                                }
                            }

                            // Handle wall running.
                            if (wallRun.enabled)
                            {
                                HandleWallRunning();
                            }

                            // If not wall running...
                            if (!wallRunning)
                            {
                                // Handle wall sliding.
                                if (wallSlide.enabled)
                                {
                                    HandleWallSliding();
                                    // If wall sliding is off and wall running is on and the player is not running...
                                }
                                else if (wallRun.enabled)
                                {
                                    // ... if the player can wall jump on the same wall and the player is on the same wall again, start the wall unstick timer.
                                    if (wallJump.enabled && wallJump.allowSameWall && AgainstSameWall())
                                    {
                                        RunWallUnstickTimer();
                                        // Or else make sure the player falls.
                                    }
                                    else
                                    {
                                        Unstick();
                                        Fall();
                                    }
                                    // Or else if the player can wall jump...
                                }
                                else if (wallJump.enabled)
                                {
                                    RunWallUnstickTimer();
                                }
                            }

                            // If boomerang wall jumping is allowed and the jump button is being pressed...
                            if (wallJump.enabled && wallJump.boomerangJump && CanSameWallJump() && Input.GetButtonDown("Jump"))
                            {
                                // ... reset the boomerang jumping timer.
                                boomerangTimer = wallJump.boomerangTime;
                                // Make sure the boomerangJump and performBoomerangJump variables are set to true.
                                boomerangJump        = true;
                                performBoomerangJump = true;
                            }
                            // Or else if the player can wall jump...
                        }
                        else if (wallJump.enabled && player.stuckToWall)
                        {
                            // ... run the unstick timer.
                            RunWallUnstickTimer();
                        }
                        // Or else...
                    }
                    else if (player.stuckToWall)
                    {
                        // Handle wall jumping.
                        if (wallJump.enabled)
                        {
                            HandleWallJumping();
                        }
                        else
                        {
                            if (player.stuckToWall && player.hor == 0)
                            {
                                Fall();
                            }
                            Unstick();
                        }
                    }
                }
            }

            // Set the wall variables used by the animator.
            player.SetWallAnimation(wallRunning, wallSliding, stuckToWall);

            // If the player is grounded...
            if (player.grounded)
            {
                // ... reset the allowSameWall variables when the player is grounded.
                onRightWall = false;
                onLeftWall  = false;

                // Reset current and last wall.
                currentWall = 0;
                lastWall    = 0;

                // Unstick the player.
                Unstick();
            }
        }