public static void Synchronize <T>(this IValueStateObserver <T> state, IEventTrigger <T> evnt) where T : struct { state.OnChange.Register(evnt); if (evnt.IsValid) { evnt.Trigger(state.Value); } }
public static void ReleaseOn(this ISemaphoreInterection semaphore, IValueStateObserver <bool> source) { source.Synchronize((value) => { if (value) { semaphore.Release(source); } else { semaphore.Block(source); } }); }
public static void ReleaseOn(this ISemaphoreInterection semaphore, IValueStateObserver <bool> source, Func <bool> eventValidation) { source.Synchronize(new ConditionalEventListener <bool>((value) => { if (value) { semaphore.Release(source); } else { semaphore.Block(source); } }, eventValidation)); }
public static void Synchronize <T>(this IValueStateObserver <T> state, IEventTrigger <T> evnt, System.Func <bool> validation) where T : struct { Synchronize <T>(state, new ConditionalEventListener <T>(evnt, () => validation() && evnt.IsValid)); }
public static void Synchronize <T>(this IValueStateObserver <T> state, IEventTrigger <T> evnt, params IEventValidator[] validators) where T : struct { var vals = validators.GetCurrentValidators(); Synchronize(state, new ConditionalEventListener <T>(evnt, () => vals.And() && evnt.IsValid)); }
public static void Synchronize <T>(this IValueStateObserver <T> state, IEventTrigger <T> evnt, IEventValidator validation) where T : struct { Synchronize <T>(state, validation.Validated <T>(evnt)); }
public static void Synchronize <T>(this IValueStateObserver <T> source, IValueStateSetter <T> valueState, IEventValidator validation) where T : struct { Synchronize <T>(source, valueState.Setter, validation); }
public Diff(IValueStateObserver <float> variableA, IValueStateObserver <float> variableB) : base(variableA, variableB) { variableA.Synchronize((v) => _operation.Setter(!Mathf.Approximately(v, variableB.Value)), _events); variableB.Synchronize((v) => _operation.Setter(!Mathf.Approximately(v, variableA.Value)), _events); }
public static void Synchronize <T>(this IValueStateObserver <T> source, IValueStateSetter <T> valueState) where T : struct { Synchronize <T>(source, valueState.Setter); }
public static void Synchronize <T>(this IValueStateObserver <T> state, System.Action evnt, System.Func <bool> validation) where T : struct { Synchronize(state, new ConditionalEventListener(evnt, validation)); }
public Diff(IValueStateObserver <float> variable, float constant) : base(variable, constant) { variable.Synchronize((v) => _operation.Setter(!Mathf.Approximately(v, constant)), _events); }
public Less(IValueStateObserver <int> variableA, IValueStateObserver <int> variableB) : base(variableA, variableB) { variableA.Synchronize((v) => _operation.Setter(v < variableB.Value), _events); variableB.Synchronize((v) => _operation.Setter(v > variableA.Value), _events); }
public static void Synchronize <T>(this IValueStateObserver <T> state, System.Action evnt) where T : struct { Synchronize(state, new ActionEventCapsule(evnt)); }
public Less(IValueStateObserver <float> variable, float constant) : base(variable, constant) { variable.Synchronize((v) => _operation.Setter(v < constant), _events); }
public GreaterThanZero(IValueStateObserver <float> variable) : base(variable, 0) { }
public LessThanZero(IValueStateObserver <int> variable) : base(variable, 0) { }
public NotZero(IValueStateObserver <float> variable) : base(variable, 0) { }
public IsZero(IValueStateObserver <int> variable) : base(variable, 0) { }
public static void Synchronize <T>(this IValueStateObserver <T> state, System.Action evnt, IEventValidator validation) where T : struct { Synchronize(state, validation.Validated(evnt)); }
public static void Synchronize <T>(this IValueStateObserver <T> state, System.Action <T> evnt, params IEventValidator[] validators) where T : struct { Synchronize(state, new ActionEventCapsule <T>(evnt), validators); }
public static void Semaphore(IValueStateObserver <bool> s, string name) { Semaphore(s != null ? s.Value : false, name); }
public Diff(IValueStateObserver <int> variable, int constant) : base(variable, constant) { variable.Synchronize((v) => _operation.Setter(v != constant), _events); }