Find all objects hit by Physics.Linecast

I have a 3d prototype I am working on, where when you move the mouse over an enemy player, a line is drawn between the player and the target using Physics.Linecast. The purpose for this line is to check if there are any walls between them, and there are two types of walls. Short walls can be shot over (albeit incurring an accuracy penalty if the enemy is crouched behind it), but tall walls should block line of sight. Individually, these work fine. If the enemy is crouched behind a short wall, you lose a 50% chance to hit - if they are on the other side of a tall wall, you are informed there is no line of sight to the target. The problem comes in if there is a short wall, then a tall wall, then another short wall the enemy is crouched behind. The linecast appears to only be looking at the first short wall, and seeing the enemy is in cover, it is completely ignoring the tall wall in between. So instead of being informed the target is out of sight, you only lose 50% chance to hit and can shoot straight through the tall wall. I’ve been stuck on this issue for a few days and thought I would reach out for help, which would be much appreciated. Edited to include linecast code.

int CheckTargetCover()
    {
        Debug.DrawLine(transform.position, target.position, Color.red);
        //if (Physics.Raycast(new Vector3(transform.position.x, (transform.position.y + .3f), transform.position.x), new Vector3(target.position.x, (target.position.y + .3f), target.position.z), out coverHit)

        RaycastHit coverHit;

        if (Physics.Linecast(transform.position, target.position, out coverHit))
        {
            if (coverHit.transform.gameObject.tag == "MultiTagObject")
            {
                //Debug.Log(coverHit.transform.name);

                if (coverHit.transform.gameObject.GetComponent<MultiTag>().Tag("tallCover"))  //if there is tall cover between you and your target, set chance to hit to 0%
                {
                    targetLineOfSight = false;
                    
                }
                else if (coverHit.transform.gameObject.GetComponent<MultiTag>().Tag("shortCover") && target.GetComponent<CharacterStats>().inCover)
                {
                    targetInCover = true;
                }
                
            }
            else
            {
                targetLineOfSight = true;
                targetInCover = false;
                //Debug.Log("No Object Hit");
            }
        }

OK, after several days of trying to figure out how to do this, I came up with a completely different idea. Something I was planning on doing but not implemented yet was to have my character turn toward the mouse cursor during his turn in battle. I went ahead and added that in using this code

Quaternion newRotation = Quaternion.LookRotation(hit.point - transform.position);  //turn character toward mouse at all times
                            newRotation.x = 0f;
                            newRotation.z = 0f;
                            transform.rotation = Quaternion.Slerp(transform.rotation, newRotation, Time.deltaTime * 10);

Ultimately, what this allowed me to do was use RayCastAll instead of Linecast. Linecast is used to draw a line between two points and only returns the first object hit, whereas RayCastAll is used to draw a line from an object in a specific direction for some distance. Since my active character would now always be facing the target, I could simply RaycastAll from my character, in the forward direction, for the distance between the character and the target. This puts all objects in between into an array, which we can then parse and check the properties of each object. Code is below

int CheckTargetCover()
    {
        Debug.DrawLine(transform.position, target.position, Color.red);

        RaycastHit[] coverHits;

        coverHits = Physics.RaycastAll(transform.position, transform.forward, distance + 1f);

        if (coverHits.Length > 0)
        {

            for (int i = 0; i < coverHits.Length; i++)
            {
                if (coverHits*.transform.gameObject.tag == "MultiTagObject")*

{
if (coverHits*.transform.gameObject.GetComponent().Tag(“tallCover”)) //if there is tall cover between you and your target, set chance to hit to 0%*
{
targetLineOfSight = false;
}
else if (coverHits*.transform.gameObject.GetComponent().Tag(“shortCover”) && target.GetComponent().inCover)*
{
targetInCover = true;
}
}
}
}

if (!targetLineOfSight)
{
return -500;
}
else if (targetInCover)
{
return -50;
}
else
{
return 0;
}
}
I’m posting this solution with the hope it helps someone in the future who is facing a similar issue.