using RaycastPro;
using RaycastPro.Detectors;
using UnityEngine;
namespace Plugins.RaycastPro.Demo.Scripts
{
public class DetectorControl : MonoBehaviour
{
[SerializeField] private ColliderDetector detector;
private void Start()
{
detector.onNewCollider.AddListener(OnNewCollider);
detector.onLostCollider.AddListener(OnLostCollider);
}
private void OnNewCollider(Collider col)
{
Debug.Log($"{col.name} is Detected.");
if (col.TryGetComponent(out NeonMaterial _neonMaterial))
{
_neonMaterial.SetNeonColor(true);
}
}
private void OnLostCollider(Collider col)
{
Debug.Log($"{col.name} is Lost Detect.");
if (col.TryGetComponent(out NeonMaterial _neonMaterial))
{
_neonMaterial.SetNeonColor(false);
}
}
}
}