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