ZoneController.cs 830 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class ZoneController : MonoBehaviour
  6. {
  7. public uint id;
  8. public string name_zone;
  9. public bool ZoneColor = true;
  10. public TextMesh TextMesh;
  11. // Start is called before the first frame update
  12. void Start()
  13. {
  14. }
  15. // Update is called once per frame
  16. void Update()
  17. {
  18. }
  19. void OnMouseOver()
  20. {
  21. if (ZoneColor) transform.GetComponent<Renderer>().material.color = new Color(0, 1, 0, 0.5f);
  22. }
  23. void OnMouseExit()
  24. {
  25. if (ZoneColor) transform.GetComponent<Renderer>().material.color = new Color(1, 0, 0, 0.5f);
  26. }
  27. public void Rename(string name_obj, string name)
  28. {
  29. gameObject.name = name_obj;
  30. TextMesh.text = name;
  31. }
  32. }