using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Receiver : MonoBehaviour
{
    public int receiverIndex;

    private Analyzer analyzer;

    // Use this for initialization
    void Start()
    {
        analyzer = GetComponentInParent<Analyzer>();
    }

    // Update is called once per frame
    void Update()
    {

    }

    public void OnTriggerStay2D(Collider2D collision)
    {
        if (collision.CompareTag("PipeEnd"))
        {
            Modulator mod = collision.GetComponentInParent<Modulator>();
            analyzer.setReceiverState(receiverIndex, mod.currentState);
        }
    }

    public void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.CompareTag("PipeEnd"))
        {
            analyzer.setReceiverState(receiverIndex, Modulator.PowerState.BLANK);
        }
    }
}
