Platformer.Player.IsAlignedToLadder C# (CSharp) Method

IsAlignedToLadder() private method

Makes sure that the player is aligned to the center of a ladder piece We may not want this, allow for horizontal ladder movement?
private IsAlignedToLadder ( ) : bool
return bool
        private bool IsAlignedToLadder()
        {
            int playerOffset = ((int)position.X % Tile.Width) - Tile.Center;
            if (Math.Abs(playerOffset) <= LadderAlignment &&
                level.GetTileCollisionBelowPlayer(new Vector2(
                    this.position.X,
                    this.position.Y + 1)) == TileCollision.Ladder ||
                level.GetTileCollisionBelowPlayer(new Vector2(
                    this.position.X,
                    this.position.Y - 1)) == TileCollision.Ladder)
            {
                // Align the player with the middle of the tile
                position.X -= playerOffset;
                return true;
            }
            else
            {
                return false;
            }
        }