Make a float var like ‘capacity’ and set it to some number. In Update, if the light is enabled, subtract a small amount from capacity. When it gets to zero, turn the light off. For extra fun, you might want to wait until the capacity is about 10%, then start setting the light’s intensity to smaller values until it reaches zero.