All attacks depend on where the unit is placed.
The priority for where it attacks is: Forward > Middle > Outside.
If you place a unit in front of an enemy unit, it will attack what is in front of it, regardless of what is to either side of it.
If you place a unit in between two enemy units AND there is no target in front of it, your unit will attack the unit on the inside of the board.
Your unit will attack enemy units on the outside tiles only if there is no enemy unit in front or on the inside.