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;
}
}