namespace Zinnia.Rule
{
using UnityEngine;
///
/// Simplifies implementing s that only accept s.
///
public abstract class GameObjectRule : Rule
{
///
public override bool Accepts(object target)
{
if (isDestroyed || ShouldAutoRejectDueToState())
{
return false;
}
GameObject targetGameObject = target as GameObject;
if (targetGameObject == null)
{
Component component = target as Component;
if (component != null)
{
targetGameObject = component.gameObject;
}
}
return targetGameObject != null && Accepts(targetGameObject);
}
///
/// Determines whether a is accepted.
///
/// The to check.
/// if is accepted, otherwise.
protected abstract bool Accepts(GameObject targetGameObject);
}
}