public void ObjectOnConditionStateUpdated(IConditionedState state, params object[] args)
        {
            bool prev = _isSatisfied;

            _isSatisfied = _object.Verify(_condition);

            if (prev != _isSatisfied)
            {
                OnObjectListenedHandler?.Invoke(_target, this);
            }
        }
Example #2
0
        public void OnTimeLimit()
        {
            if (_target == null)
            {
                return;
            }

            float distance = (_source.Transform.position - _target.Transform.position).magnitude;

            if (Cirrus.Utils.Mathf.CloseEnough(distance, _previousDistance, _sampleTolerance))
            {
                return;
            }

            _previousDistance = distance;

            if (_comparison == null)
            {
                OnObjectListenedHandler?.Invoke(_target);
                return;
            }

            bool res = _comparison.Verify(distance);

            // If results are different (veto or satisfied)
            if (_previousComparisonResult != res)
            {
                _previousComparisonResult = res;
                OnObjectListenedHandler?.Invoke(_target);
            }
            // if satisfied, then diff distance yield different result
            else if (!res)
            {
                _previousComparisonResult = res;
                OnObjectListenedHandler?.Invoke(_target);
            }
        }
 public void OnTimeLimit()
 {
     OnObjectListenedHandler?.Invoke(_target);
 }