Stop Timebar decrease by pressing key button

Hi guys, My problem is to stop decreasing my Timebar.
If I press the “B” key, it needs to stop decreasing.

This is my current JavaScript for the Timebar, but I can’t figure it out how to fix my problem. Maybe you can.

var totalTime = 25.0;
var remainingTime = 25.0;


function Update() {
    if (remainingTime > 0.0)
       remainingTime -= Time.deltaTime;
}

What I mean is by example, as you can see, totalTime = 25 and it decreases to 0. So by example if totalTime is decreased to 7 and I press the “B” key button. Then totalTime will stop with decreasing.

Please help :smiley:

EDIT

Someone please help, my problem is still unsolved :frowning:

You just have to add one extra condition,
if (remainingTime > 0.0 && !Input.GetKey(KeyCode.B))
remainingTime -= Time.deltaTime