sanity regenerate overtime

so I have a sanity system that drops over time and is tied to a slide bar. I want when you enter a triggered collider sanity stops going down and starts slowly regenerating, also stops when full. Any suggestions how I would go about this?

Here is my sanity script

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

public class sanitymeter : MonoBehaviour
{
    [Header("Matches Parameters")]
    public float MaxSanity = 100f;
    public float Sanity = 0f;
    public float santiyOT = 0.008f;
    public Slider SanitySlider;

    void Start()
    {
        
    }

    void Update()
    {
        Sanity = Sanity - santiyOT * Time.deltaTime;

        SanitySlider.value = Sanity / MaxSanity;
    }
}

solved it

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

public class sanitymeter : MonoBehaviour
{
    [Header("Sanity Parameters")]
    public float MaxSanity = 100f;
    public float Sanity = 0f;
    public float santiyOT = 0.008f;
    public float RegSanityOT = 0.008f;
    public Slider SanitySlider;
    public bool notinlight;
    public AudioSource heartbeat;

    void Start()
    {
        notinlight = true;
    }

    void Update()
    {
         if (notinlight == true && Sanity >= 0)
        {
            Sanity = Sanity - santiyOT * Time.deltaTime;

            SanitySlider.value = Sanity / MaxSanity;

            if (Sanity == 75)
            {
               heartbeat.Play();
            }

            if (Sanity <= 50)
            {
                FirstPerson.OnTakeDamage(5 * Time.deltaTime);
            }


            if (Sanity <=1)
            {
                FirstPerson.OnTakeDamage(50);
            }
        }

         else if (notinlight == false && Sanity <= 100)
        {
            Sanity = Sanity + RegSanityOT * Time.deltaTime;

            SanitySlider.value = Sanity / MaxSanity;

        }

    }
    void OnTriggerStay(Collider target)
    {
        if (target.tag == "candle")
        {
            notinlight = false;
        }
    }
    private void OnTriggerExit(Collider coll)//entrance and exit to/from trigger 
    {
        if (coll.tag == "candle")
        {
            notinlight = true;
        }
    }
}