How to make drag n shooting avaiable only at 0 velocity?

I watched a video about making 2D games so I copied the code he gave and it works excellent, but I want to be able to drag n shoot only when the player is in “asleep” state, so his velocity is at 0. Can anyone modify this code so I can only shoot when the player isn’t moving?

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

public class PiłkaKontrola : MonoBehaviour {
public float power = 10f;
public float maxDrag = 5f;
public Rigidbody2D rb;
public LineRenderer lr;

Vector3 dragStartPos;
Touch touch;

private void Update() {
    if (Input.touchCount > 0) {
        touch = Input.GetTouch(0);

        if(touch.phase == TouchPhase.Began) {
            DragStart();
        }
        if(touch.phase == TouchPhase.Moved) {
            Dragging();
        }
        if (touch.phase == TouchPhase.Ended) {
            DragRelease();
        }
    }
}
void DragStart() {
    dragStartPos = Camera.main.ScreenToWorldPoint(touch.position);
    dragStartPos.z = 0f;
    lr.positionCount = 1;
    lr.SetPosition(0, dragStartPos);
}
void Dragging() { 
    Vector3 draggingPos = Camera.main.ScreenToWorldPoint(touch.position);
    draggingPos.z = 0f;
    lr.positionCount = 2;
    lr.SetPosition(1, draggingPos);
}
void DragRelease() {
    lr.positionCount = 0;
    
    Vector3 dragReleasePos = Camera.main.ScreenToWorldPoint(touch.position);
    dragReleasePos.z = 0f;

    Vector3 force = dragStartPos - dragReleasePos;
    Vector3 clampedForce = Vector3.ClampMagnitude(force, maxDrag) * power;

    rb.AddForce(clampedForce, ForceMode2D.Impulse);
}

}

Rigidbody (so “rb” in this script) has a property for Velocity.
All you need is if (rb.velocity.magnitude == 0) {
// Drag / shoot code here
}

I would reccomend doing it as if (rb.velocity.magnitude < 0.1f) tho because your velocity is never going to be perfectly 0 with a physics based character