bool clearSight(RaycastHit2D[] hits)
{
foreach (RaycastHit2D hit in hits)
{
// ignore the enemy's own colliders (and other enemies) and the camera bounds
if (hit.transform.tag == "Enemy")
continue;
if (hit.transform.tag == "camerabounds")
continue;
if (hit.transform.tag == "Untagged")
continue;
Debug.Log(hit.transform.tag);
// if anything other than the player is hit then it must be between the player and the enemy's eyes (since the player can only see as far as the player)
if (hit.transform.tag != "Player")
{
Debug.Log(hit.transform.tag);
return false;
}
//if we get here then the player is not obstructed
if(hit.transform.tag == "Player"){
return true;
}
}
return false;
}