How can I make this code work with left mouse click?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Bola : MonoBehaviour
{
  Vector2 posInicial, posFinal, direcao;
  private float touchTimeInicial, touchTimeFinal, touchTime;
  public float forcaLancamento = 0.5f;

  private void Update()
  {
    if(Input.touchCount && Input.GetTouch(0).phase == TouchPhase.Began)
    {
        touchTimeInicial = Time.time;
        posInicial = Input.GetTouch(0).position;

    }

    if(Input.touchCount && Input.GetTouch(0).phase == TouchPhase.Ended)
    {
        touchTimeFinal = Time.time;
        touchTime = touchTimeFinal - touchTimeInicial;
        posFinal = Input.GetTouch(0).position;
        direcao = posFinal - posInicial;
        GetComponent<Rigidbody2D>().AddForce(direcao / touchTime * forcaLancamento);
    }

  }
    
}

You’ll need a collider on the ball, of course…

using UnityEngine;

public class Bola : MonoBehaviour
{
    Rigidbody2D rb;
    Vector2 posInicial;
    float mouseTimeInicial;
    float forcaLancamento = 0.5f;

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
    }

    public void OnMouseDown()
    {
        posInicial = Input.mousePosition;
        mouseTimeInicial = Time.time;
    }

    private void OnMouseUp()
    {
        float mouseTime = Time.time - mouseTimeInicial;
        Vector2 direcao = (Vector2) (Input.mousePosition) - posInicial;
        rb.AddForce(direcao / mouseTime * forcaLancamento);
    }
}