/// <summary>
/// 是否在屏幕内
/// </summary>
/// <param name="targetPosition">目标点</param>
/// <returns></returns>
protected bool IsInScreen(Vector3 targetPosition, Camera camera)
{
Vector3 viewportPoint = camera.WorldToViewportPoint(targetPosition);
return viewportPoint.x >= 0 && viewportPoint.y >= 0 && viewportPoint.x <= 1 && viewportPoint.y <= 1 && viewportPoint.z > camera.nearClipPlane;
}