3DTD/Assets/Scripts/Utilities/EnableCompare.cs

29 lines
565 B
C#

using UnityEngine;
public class EnableCompare : MonoBehaviour
{
[SerializeField] private GameObject toEnable;
[SerializeField] private float threshold = 20f;
public void EnableIfLess(float value)
{
if (value < threshold)
{
toEnable.SetActive(true);
}
}
public void EnableIfGreater(float value)
{
if (value > threshold)
{
toEnable.SetActive(true);
}
}
public void ForceEnable()
{
toEnable.SetActive(true);
}
}