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

29 lines
565 B
C#
Raw Normal View History

2024-04-21 02:34:45 +02:00
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);
}
}
2024-04-21 08:03:18 +02:00
public void ForceEnable()
{
toEnable.SetActive(true);
}
2024-04-21 02:34:45 +02:00
}