InfraredSourceView.cs 741 B

1234567891011121314151617181920212223242526272829
  1. using UnityEngine;
  2. using System.Collections;
  3. public class InfraredSourceView : MonoBehaviour
  4. {
  5. public GameObject InfraredSourceManager;
  6. private InfraredSourceManager _InfraredManager;
  7. void Start ()
  8. {
  9. gameObject.GetComponent<Renderer>().material.SetTextureScale("_MainTex", new Vector2(-1, 1));
  10. }
  11. void Update()
  12. {
  13. if (InfraredSourceManager == null)
  14. {
  15. return;
  16. }
  17. _InfraredManager = InfraredSourceManager.GetComponent<InfraredSourceManager>();
  18. if (_InfraredManager == null)
  19. {
  20. return;
  21. }
  22. gameObject.GetComponent<Renderer>().material.mainTexture = _InfraredManager.GetInfraredTexture();
  23. }
  24. }