How to make a player lose if they don't reach specific areas quick enough?

Hello, I’m very new to coding and I primarily resort to watching YouTube tutorials step-by-step. The language that I use is C#, and I’m wondering how I would go about having a player die if they don’t reach specific areas in time. The game I’m attempting to make is where a 2D sprite walks down a street and hides from people frequently looking through their windows by being in the darkness between street lamps. Would anyone know how to go about doing this? Thanks.alt text
I’ve attached a picture of the game so far, to possibly help visualize. I’m looking for the “safe zone” to be between the street lamps, where the light doesn’t reach.

@Digitroni you can add box collider 2d to the player and the safe zone, check the isTrigger box, and make sure your player gameobject tag is “Player”. Then attach a new script like the script below to your safe zone game object.

public float limitTime;
float unsafeTime = limitTime;
bool reached;

void Update () {
     if (reached) { unsafeTime = limitTime; }
     else { unsafeTime -= Time.deltaTime; }
    if (unsafeTime <= 0f) { //Do something like destroy the player or show the gameover text, ... }
void OnTriggerEnter2D (Collider2D other) { if (other.gameObject.tag == "Player") { reached = true; } }
void OnTriggerExit2D (Collider2D other) { if (other.gameObject.tag == "Player") { reached = false; } }