Movement/State/MemberToggleState.cs

26 lines
576 B
C#

using UnityEngine.Events;
namespace Syntriax.Modules.Movement.State
{
public class MemberToggleState : IToggleState
{
private bool _enabled = true;
public bool Toggled
{
get => _enabled;
set
{
bool isNewValue = _enabled != value;
_enabled = value;
if (isNewValue)
OnToggleStateChanged.Invoke(value);
}
}
public UnityEvent<bool> OnToggleStateChanged { get; protected set; } = new UnityEvent<bool>();
}
}