Files
LowPolyRPG/Assets/Plugins/RaycastPro/_Demo/_Scripts/LightDetectUI.cs

34 lines
866 B
C#
Raw Normal View History

2025-06-25 11:10:11 +01:00
using System.Collections;
using System.Collections.Generic;
using RaycastPro.Detectors;
using UnityEngine;
using UnityEngine.UI;
namespace Plugins.RaycastPro.Demo.Scripts
{
public class LightDetectUI : MonoBehaviour
{
public LightDetector detector;
public MeshRenderer agentLight;
public Image lightUI;
private static readonly int EmissionColor = Shader.PropertyToID("_EmissionColor");
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
lightUI.color = detector.Performed ? Color.green : Color.red;
agentLight.materials[1].SetColor(EmissionColor, lightUI.color);
agentLight.materials[2].SetColor(EmissionColor, lightUI.color);
}
}
}