ColorSourceView.cs 732 B

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