I want to add a delay to the crouch keys .so wen i crouch i should wait 1 second o be able to uncrouch again . how?

I want to add a delay to the crouch keys .so wen i crouch i should wait 1 second o be able to uncrouch again . how?

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

public class PlayerScript : MonoBehaviour
{
    [Header("Movement")]
    public float walkSpeed = 5f;
    public float runSpeed = 8f;
    public float crouchSpeed = 3f;
    public float jumpForce = 8f;
    public float gravity = 9.81f; // Adjust gravity value as needed
    public KeyCode runKey = KeyCode.LeftShift; // Change default joystick button for running
    public KeyCode jumpKey = KeyCode.Space;
    public KeyCode crouchKey = KeyCode.LeftControl; // Default joystick button for crouching
    public KeyCode gamepadRunButton = KeyCode.JoystickButton5;
    public KeyCode gamepadJumpButton = KeyCode.JoystickButton2;
    public KeyCode gamepadCrouchButton = KeyCode.JoystickButton1;

    private KeyCode additionalCrouchKey = KeyCode.C; // Additional hardcoded key for crouching

    public bool enableJump = false; // Toggle jump in the inspector
    public bool enableCrouching = true; // Toggle crouching in the inspector
    public bool enableRunning = true; // Toggle running in the inspector

    public float crouchHeightMultiplier = 0.5f;
    private float originalHeight;
    private bool isRunning;
    private bool isCrouching;
    private bool isUncrouching;
    private float uncrouchTransitionTime = 1.0f; // Time taken to transition from crouch to stand
    private float currentTransitionTime;
    private float targetHeight;
    private CharacterController controller;
    private Vector3 verticalVelocity;
    private bool isInsideCrawlingTrigger = false;
    private bool initialCrouch = true; // Flag to simulate initial crouch

    private void Start()
    {
        controller = GetComponent<CharacterController>();
        originalHeight = controller.height;
        isRunning = enableRunning;
    }

    private void Update()
    {
        // Check for movement input
        float horizontalInput = Input.GetAxis("Horizontal");
        float verticalInput = Input.GetAxis("Vertical");
        Vector3 moveDirection = transform.right * horizontalInput + transform.forward * verticalInput;

        // Determine speed based on movement state
        float speed = isCrouching ? crouchSpeed : (isRunning ? runSpeed : walkSpeed);

        // Apply gravity
        if (controller.isGrounded)
        {
            verticalVelocity.y = -0.5f;
        }
        else
        {
            verticalVelocity.y -= gravity * Time.deltaTime;
        }

        // Apply jump
        if (controller.isGrounded && enableJump)
        {
            if (Input.GetKeyDown(jumpKey) || Input.GetKeyDown(gamepadJumpButton))
            {
                verticalVelocity.y = jumpForce;
            }
        }

        // Apply vertical velocity
        moveDirection.y = verticalVelocity.y;

        // Apply movement
        controller.Move(moveDirection * speed * Time.deltaTime);

        // Check for running input
        if (enableRunning)
        {
            isRunning = Input.GetKey(runKey) || Input.GetKey(gamepadRunButton);
        }

        // Check for crouching input
        if (isInsideCrawlingTrigger)
        {
            if (!isCrouching)
            {
                isCrouching = true;
                controller.height *= crouchHeightMultiplier;
            }
        }
        else
        {
            if (enableCrouching)
            {
                if ((Input.GetKeyDown(crouchKey) || Input.GetKeyDown(gamepadCrouchButton) || Input.GetKeyDown(additionalCrouchKey)) && !isCrouching)
                {
                    isCrouching = true;

                    // Change height when crouching outside the trigger
                    controller.height *= crouchHeightMultiplier;
                }
                else if ((Input.GetKeyDown(crouchKey) || Input.GetKeyDown(gamepadCrouchButton) || Input.GetKeyDown(additionalCrouchKey)) && isCrouching)
                {
                    // Initiate uncrouch transition
                    targetHeight = originalHeight;
                    isUncrouching = true;
                    currentTransitionTime = 0f;

                    // Reset speed and states instantly
                    isCrouching = false;
                    isRunning = enableRunning;
                }
            }
        }

        // Perform uncrouch transition if triggered
        if (isUncrouching)
        {
            currentTransitionTime += Time.deltaTime;
            float t = Mathf.Clamp01(currentTransitionTime / uncrouchTransitionTime);
            controller.height = Mathf.Lerp(controller.height, targetHeight, t);

            if (t >= 1.0f)
            {
                isUncrouching = false;
                controller.height = originalHeight; // Ensure the height is set to the original after transition
            }
        }
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Crawling trigger"))
        {
            isInsideCrawlingTrigger = true;
        }
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.CompareTag("Crawling trigger"))
        {
            isInsideCrawlingTrigger = false;
        }
    }
}