How can I check the line of sight to see if the player is visible to the enemy?

How can I make an if statement that runs if there is a line of sight between two objects? For example checking if a enemy can see the player in a maze like map?

You can use Raycasting to do this.

Cast a ray from the enemy object to the player object, and check the hit results. If the first hit result is the player, then the enemy can see the player.

For example, in your Enemy script (make sure the "player" variable has a reference to the player in it):

var player : Transform;

function Update  () {

    var hit : RaycastHit;
    var rayDirection = player.position - transform.position;

    if (Physics.Raycast (transform.position, rayDirection, hit)) {

        if (hit.transform == player) {
            // enemy can see the player!
        } else {
            // there is something obstructing the view
        }

    }

}