public bool CanSeeOtherPlayer(PlayerScript other)
{
Transform startTransform = CameraScript.CameraUsed != null ? CameraScript.CameraUsed.transform : transform;
Vector3 start = startTransform.position;
Vector3 direction = (other.transform.position - start).normalized;
float distance = Vector3.Distance(start, other.transform.position);
RaycastHit hitInfo;
// Maybe
if (Physics.Raycast(start, direction, out hitInfo, distance, OtherPlayerVisibilityLayerMask))
{
var hitPlayer = hitInfo.collider.GetComponentInParent<PlayerScript>();
return hitPlayer != null && hitPlayer == other;
}
// Nope
return false;
}