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

public class TrailCollider : MonoBehaviour
{
    public Color gizmoColor = Color.red;
    public TrailMgr trailMgr;
    public float radius;
    void Update(){
        Collider2D hit = Physics2D.OverlapCircle(transform.position, radius);
        if(hit!=null){
            if(hit.transform.root == trailMgr.transform){return;} // <-- avoid eating myself
            trailMgr.OnColliderHit(hit);
        }
    }

    private void OnDrawGizmos() {
        Gizmos.color = gizmoColor;
        Gizmos.DrawWireSphere(transform.position,radius);
    }
}
