InfraredLightGuider.cs 1003 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using InfraredManager;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. //处理光源检测部分
  7. public class InfraredLightGuider : MonoBehaviour
  8. {
  9. [SerializeField]
  10. RawImage rawImage;
  11. //相机感光部分
  12. [SerializeField]
  13. Slider slider;
  14. // Start is called before the first frame update
  15. void Start()
  16. {
  17. if (InfraredDemo._ins)
  18. {
  19. slider.onValueChanged.AddListener((value) =>
  20. {
  21. InfraredDemo._ins.onSliderEvent(value);
  22. });
  23. InfraredDemo._ins.onSetSliderValue(slider);
  24. }
  25. }
  26. void Update()
  27. {
  28. if (InfraredDemo.running)
  29. {
  30. //渲染相机画面
  31. rawImage.texture = InfraredDemo.infraredCameraHelper.GetCameraTexture();
  32. //rawImage.material = InfraredDemo.infraredCameraHelper.GetCameraMaterial();
  33. }
  34. }
  35. public void Close() {
  36. Destroy(gameObject);
  37. }
  38. }