Movement/State/MemberToggleState.cs

26 lines
532 B
C#

using System;
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 Action<bool> OnToggleStateChanged { get; set; } = null;
}
}