State/MemberToggleState.cs

25 lines
528 B
C#

using System;
namespace Syntriax.Modules.Movement.State
{
public class MemberToggleState : IToggleState
{
private bool _toggled = true;
public bool Toggled
{
get => _toggled;
set
{
bool oldValue = _toggled;
_toggled = value;
if (oldValue = !value)
OnToggleStateChanged?.Invoke(value);
}
}
public Action<bool> OnToggleStateChanged { get; set; } = null;
}
}