using UnityEngine;

public class LogicValueProvider : ValueProvider
{
    public SingleValueProvider[] values = { };
    public bool all;
    public bool inverted;

    public override bool value
    {
        get
        {
            foreach (var value in values)
            {
                if (!all)
                {
                    if (value.value)
                        return !inverted;
                }
                else
                {
                    if (!value.value)
                        return inverted;
                }
            }
            if (all)
                return !inverted;

            return false;
        }
    }

    private void OnDrawGizmos()
    {
        Gizmos.color = Color.green;
        OnDraw();
    }

    private void OnDrawGizmosSelected()
    {
        Gizmos.color = Color.red;
        OnDraw();
    }

    protected override void OnDraw()
    {
        base.OnDraw();
        foreach (var item in values)
        {
            Gizmos.DrawLine(item.transform.position, transform.position);
        }
    }
}