fix the script:
using UnityEngine;

[RequireComponent(typeof(Animator))]
public class DragonController : MonoBehaviour
{
    [Header("Dragon Settings")]
    public float takeOffHeight = 12f;
    public float takeOffSpeed = 5f;
    public float landingSpeed = 5f;
    public float animationSpeed = 1f;
    public float movementSpeed = 5f;

    [Header("BlendShape Settings")]
    [SerializeField] private SkinnedMeshRenderer skinnedMeshRenderer;
    public float blendShapeSmoothSpeed = 5f;

    private Animator animator;
    private Camera mainCam;

    private bool isGrounded = true;
    private bool isFlying = false;
    private bool isLanding = false;

    private float targetY = 0f;

    private float[] targetBlendShapes;
    private int blendShapeCount;

    private void Start()
    {
        animator = GetComponent<Animator>();

        mainCam = Camera.main;
        if (mainCam == null)
        {
            Debug.LogError("Main camera not found! Please tag your camera as 'MainCamera'.");
        }

        animator.SetBool("IsIdle", true);
        animator.applyRootMotion = false;

        if (skinnedMeshRenderer && skinnedMeshRenderer.sharedMesh != null)
        {
            blendShapeCount = skinnedMeshRenderer.sharedMesh.blendShapeCount;
            targetBlendShapes = new float[blendShapeCount];
        }

        targetY = transform.position.y;
    }

    private void Update()
    {
        animator.speed = animationSpeed;

        HandleInput();

        SmoothBlendshape();

        HandleFlight();
    }

    private void HandleInput()
    {
        if (isGrounded && !isFlying)
        {
            HandleGroundMovement();
        }
        else
        {
            HandleFlyingMovement();
        }
    }

    private void HandleGroundMovement()
    {
        bool isIdle = true;

        if (Input.GetKey(KeyCode.W))
        {
            animator.SetBool("IsCrawling", true);
            isIdle = false;
            transform.position += transform.forward * movementSpeed * Time.deltaTime;
        }
        else
        {
            animator.SetBool("IsCrawling", false);
        }

        if (Input.GetKey(KeyCode.A))
        {
            animator.SetBool("IsCrawlingLeft", true);
            isIdle = false;
            transform.position -= transform.right * movementSpeed * Time.deltaTime;
        }
        else
        {
            animator.SetBool("IsCrawlingLeft", false);
        }

        if (Input.GetKey(KeyCode.D))
        {
            animator.SetBool("IsCrawlingRight", true);
            isIdle = false;
            transform.position += transform.right * movementSpeed * Time.deltaTime;
        }
        else
        {
            animator.SetBool("IsCrawlingRight", false);
        }

        animator.SetBool("IsIdle", isIdle);

        if (Input.GetKeyDown(KeyCode.Space))
        {
            animator.SetTrigger("TakeOff");
            isGrounded = false;
            isFlying = true;
            targetY = takeOffHeight;
        }

        if (Input.GetMouseButtonDown(0))
        {
            animator.SetTrigger("Roar");
        }
    }

    private void HandleFlyingMovement()
    {
        if (mainCam == null)
            return; // Can't proceed without camera

        Vector3 screenCenter = new Vector3(Screen.width / 2f, Screen.height / 2f, 0f);

        Ray ray = mainCam.ScreenPointToRay(screenCenter);

        if (Physics.Raycast(ray, out RaycastHit hit, 1000f))
        {
            Vector3 targetPoint = hit.point;

            // Calculate horizontal direction to target point
            Vector3 directionToTarget = targetPoint - transform.position;
            directionToTarget.y = 0;

            // Rotate smoothly towards target direction if it's significant
            if (directionToTarget.sqrMagnitude > 0.001f)
            {
                Quaternion targetRotation = Quaternion.LookRotation(directionToTarget);
                transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 5f);
            }
        }
        else
        {
            // No valid target point, don't rotate or move horizontally
        }

        // Input keys
        bool wPressed = Input.GetKey(KeyCode.W);
        bool sPressed = Input.GetKey(KeyCode.S);
        bool aPressed = Input.GetKey(KeyCode.A);
        bool dPressed = Input.GetKey(KeyCode.D);

        Vector3 flyDirection = Vector3.zero;

        // Flying forward (W) moves forward
        if (wPressed && !sPressed)
        {
            flyDirection += transform.forward;
            animator.SetBool("IsFlying", true);
            animator.SetBool("IsHovering", false);
        }
        else if (sPressed)
        {
            // Hovering + backward flight on S
            flyDirection -= transform.forward;
            animator.SetBool("IsFlying", false);
            animator.SetBool("IsHovering", true);
        }
        else
        {
            // Not moving forward or backward
            animator.SetBool("IsFlying", false);
            animator.SetBool("IsHovering", false);
        }

        // Strafing left/right animations and movements
        animator.SetBool("IsFlyingLeft", aPressed);
        animator.SetBool("IsFlyingRight", dPressed);

        if (aPressed)
            flyDirection -= transform.right;
        if (dPressed)
            flyDirection += transform.right;

        // Normalize flight direction to avoid faster diagonal movement
        if (flyDirection != Vector3.zero)
        {
            flyDirection = flyDirection.normalized;
            transform.position += flyDirection * movementSpeed * Time.deltaTime;
        }

        // Gliding fire breath animation
        animator.SetBool("IsGlidingFire", Input.GetMouseButton(0));

        // Landing / Takeoff control
        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (isFlying && !isLanding)
            {
                animator.SetTrigger("Land");
                isLanding = true;

                // Determine terrain height for landing using raycast down
                if (Physics.Raycast(transform.position + Vector3.up * 10f, Vector3.down, out RaycastHit hitInfo, 20f))
                {
                    targetY = hitInfo.point.y;
                }
                else
                {
                    targetY = 0f;
                }
            }
            else if (isGrounded && !isFlying)
            {
                animator.SetTrigger("TakeOff");
                isFlying = true;
                isGrounded = false;
                targetY = takeOffHeight;
            }
        }
    }

    private void HandleFlight()
    {
        if (!isFlying && !isLanding)
            return;

        float step = (isLanding ? landingSpeed : takeOffSpeed) * Time.deltaTime;

        Vector3 position = transform.position;

        position.y = Mathf.MoveTowards(position.y, targetY, step);

        transform.position = position;

        if (isLanding && Mathf.Approximately(position.y, targetY))
        {
            isLanding = false;
            isFlying = false;
            isGrounded = true;

            // Reset animations after landing
            animator.SetBool("IsFlying", false);
            animator.SetBool("IsHovering", false);
        }
    }

    private void SmoothBlendshape()
    {
        if (skinnedMeshRenderer == null || skinnedMeshRenderer.sharedMesh == null || blendShapeCount == 0)
            return;

        for (int i = 0; i < blendShapeCount; i++)
        {
            float currentWeight = skinnedMeshRenderer.GetBlendShapeWeight(i);
            float targetWeight = targetBlendShapes[i];
            float newWeight = Mathf.Lerp(currentWeight, targetWeight, Time.deltaTime * blendShapeSmoothSpeed);
            skinnedMeshRenderer.SetBlendShapeWeight(i, newWeight);
        }
    }

    public void SetTargetBlendShape(int index, float weight)
    {
        if (targetBlendShapes != null && index >= 0 && index < targetBlendShapes.Length)
        {
            targetBlendShapes[index] = weight;
        }
    }
}

I want the camera to interact like in Call Of Duty when moving the mouse, the dragon should focus on the center of the screen wherever the mouse is positioned and move towards that point

Show the whole updated script