25 lines
557 B
C#
25 lines
557 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace Syntriax.Modules.ToggleState
|
|
{
|
|
public class ToggleStateMonoBehaviour : MonoBehaviour, IToggleState
|
|
{
|
|
private bool _isToggled = true;
|
|
public bool IsToggled
|
|
{
|
|
get => _isToggled;
|
|
set
|
|
{
|
|
if (value == _isToggled)
|
|
return;
|
|
|
|
_isToggled = value;
|
|
OnToggleStateChanged?.Invoke(value);
|
|
}
|
|
}
|
|
|
|
public Action<bool> OnToggleStateChanged { get; set; } = null;
|
|
}
|
|
}
|