Example #1
0
 public static void ReleaseOn(this ISemaphoreInterection semaphore, IValueStateObserver <bool> source)
 {
     source.Synchronize((value) => { if (value)
                                     {
                                         semaphore.Release(source);
                                     }
                                     else
                                     {
                                         semaphore.Block(source);
                                     } });
 }
Example #2
0
 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));
 }
Example #3
0
 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);
 }
Example #4
0
 public Less(IValueStateObserver <float> variable, float constant) : base(variable, constant)
 {
     variable.Synchronize((v) => _operation.Setter(v < constant), _events);
 }
Example #5
0
 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);
 }
Example #6
0
 public Diff(IValueStateObserver <float> variable, float constant) : base(variable, constant)
 {
     variable.Synchronize((v) => _operation.Setter(!Mathf.Approximately(v, constant)), _events);
 }
Example #7
0
 public Diff(IValueStateObserver <int> variable, int constant) : base(variable, constant)
 {
     variable.Synchronize((v) => _operation.Setter(v != constant), _events);
 }