diff options
Diffstat (limited to 'Thronefall_v1.0/Decompile/Checkbox.cs')
-rw-r--r-- | Thronefall_v1.0/Decompile/Checkbox.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Thronefall_v1.0/Decompile/Checkbox.cs b/Thronefall_v1.0/Decompile/Checkbox.cs new file mode 100644 index 0000000..40e1344 --- /dev/null +++ b/Thronefall_v1.0/Decompile/Checkbox.cs @@ -0,0 +1,29 @@ +using UnityEngine; +using UnityEngine.Events; + +public class Checkbox : MonoBehaviour +{ + public UnityEvent onToggle = new UnityEvent(); + + public bool state; + + public GameObject checkObj; + + public void SetState(bool active) + { + state = active; + UpdateDisplay(); + } + + public void Toggle() + { + state = !state; + UpdateDisplay(); + onToggle.Invoke(); + } + + private void UpdateDisplay() + { + checkObj.SetActive(state); + } +} |