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 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 Less(IValueStateObserver <float> variable, float constant) : base(variable, constant) { variable.Synchronize((v) => _operation.Setter(v < constant), _events); }
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 Diff(IValueStateObserver <float> variable, float constant) : base(variable, constant) { variable.Synchronize((v) => _operation.Setter(!Mathf.Approximately(v, constant)), _events); }
public Diff(IValueStateObserver <int> variable, int constant) : base(variable, constant) { variable.Synchronize((v) => _operation.Setter(v != constant), _events); }