using UnityEngine;

public abstract class ValueProvider : MonoBehaviour
{
    public abstract bool value { get; }

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

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

    protected virtual void OnDraw()
    {
    }
}

public class SingleValueProvider : ValueProvider
{
    public SolidButton button;
    public bool inverted;

    public override bool value => inverted ? !(button?.value ?? false) : (button?.value ?? false);

    protected override void OnDraw()
    {
        base.OnDraw();
        if (button != null)
            Gizmos.DrawLine(button.transform.position, transform.position);
    }
}