public void ObjectOnConditionStateUpdated(IConditionedState state, params object[] args) { bool prev = _isSatisfied; _isSatisfied = _object.Verify(_condition); if (prev != _isSatisfied) { OnObjectListenedHandler?.Invoke(_target, this); } }
public ConditionListener(BaseObject source, BaseObject target, ICondition condition) : base(target) { _object = source; _condition = condition; _state = condition.GetListenedState(target); if (_state != null) { _state.OnStateChangedHandler += ObjectOnConditionStateUpdated; } }