namespace Zinnia.Rule
{
using UnityEngine;
using Zinnia.Extension;
using Zinnia.Rule.Collection;
///
/// Determines whether any in a list is accepting an object.
///
public class AnyRule : Rule
{
[Tooltip("The IRules to check against.")]
[SerializeField]
private RuleContainerObservableList rules;
///
/// The s to check against.
///
public RuleContainerObservableList Rules
{
get
{
return rules;
}
set
{
rules = value;
}
}
///
public override bool Accepts(object target)
{
if (ShouldAutoRejectDueToState() || Rules == null)
{
return false;
}
foreach (RuleContainer rule in Rules.NonSubscribableElements)
{
if (rule.Accepts(target))
{
return true;
}
}
return false;
}
}
}